Skip to content

Commit

Permalink
feat: added visualization wms creation for rasdaman endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
santilland committed Oct 7, 2024
1 parent bbb6489 commit 1f7b876
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions src/eodash_catalog/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ def process_WCS_rasdaman_Endpoint(
version=endpoint_config.get("Version", "2.0.1"),
)
for dt in datetimes:
new_item = Item(
item = Item(
id=format_datetime_to_isostring_zulu(dt),
bbox=bbox,
properties={},
geometry=None,
datetime=dt,
)
link = collection.add_item(new_item)
add_visualization_info(item, collection_config, endpoint_config, datetimes=[dt])
link = collection.add_item(item)
# bubble up information we want to the link
link.extra_fields["datetime"] = format_datetime_to_isostring_zulu(dt)

Expand Down Expand Up @@ -752,6 +753,38 @@ def add_visualization_info(
link,
)
stac_object.add_link(link)
elif endpoint_config["Name"] == "rasdaman":
extra_fields.update(
{
"wms:layers": [endpoint_config["CoverageId"]],
"role": ["data"],
}
)
dimensions = {}
if dimensions_config := endpoint_config.get("Dimensions", {}):
for key, value in dimensions_config.items():
dimensions[key] = value
if datetimes is not None:
dimensions["TIME"] = format_datetime_to_isostring_zulu(datetimes[0])
if dimensions != {}:
extra_fields["wms:dimensions"] = dimensions
if "Styles" in endpoint_config:
extra_fields["wms:styles"] = endpoint_config["Styles"]
media_type = endpoint_config.get("MediaType", "image/png")
endpoint_url = endpoint_config["EndPoint"]
# custom replacing of all ENV VARS present as template in URL as {VAR}
link = Link(
rel="wms",
target=endpoint_url,
media_type=media_type,
title=collection_config["Name"],
extra_fields=extra_fields,
)
add_projection_info(
endpoint_config,
link,
)
stac_object.add_link(link)
elif endpoint_config["Name"] == "JAXA_WMTS_PALSAR":
target_url = "{}".format(endpoint_config.get("EndPoint"))
# custom time just for this special case as a default for collection wmts
Expand Down

0 comments on commit 1f7b876

Please sign in to comment.