Skip to content

Commit

Permalink
add MapProjection info
Browse files Browse the repository at this point in the history
  • Loading branch information
lubojr committed Jul 12, 2024
1 parent e7049c9 commit 6b97c97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/eodash_catalog/stac_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ def add_extra_fields(stac_object: Collection | Catalog | Link, collection_config
stac_object.extra_fields["sensor"] = collection_config["Sensor"]
if "Agency" in collection_config:
stac_object.extra_fields["agency"] = collection_config["Agency"]
if "yAxis" in collection_config:
stac_object.extra_fields["yAxis"] = collection_config["yAxis"]
if "EodashIdentifier" in collection_config:
stac_object.extra_fields["subcode"] = collection_config["EodashIdentifier"]
if "DataSource" in collection_config:
Expand All @@ -375,6 +373,8 @@ def add_extra_fields(stac_object: Collection | Catalog | Link, collection_config
stac_object.extra_fields["insituSources"] = collection_config["DataSource"]["InSitu"]
if "Other" in collection_config["DataSource"]:
stac_object.extra_fields["otherSources"] = collection_config["DataSource"]["Other"]
if "MapProjection" in collection_config:
stac_object.extra_fields["mapProjection"] = collection_config["MapProjection"]


def get_collection_times_from_config(endpoint_config: dict) -> list[str]:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ def test_indicator_groups_collections(catalog_output_folder):
assert [-145.24, -61.13, -135.15, -65.05] in indicator_bbox


def test_indicator_map_projection_added(catalog_output_folder):
collection_name = "test_indicator_grouping_collections"
root_collection_path = os.path.join(catalog_output_folder, collection_name)
with open(os.path.join(root_collection_path, "collection.json")) as fp:
indicator_json = json.load(fp)
# test that collection has map projection defined
assert indicator_json["mapProjection"] == 3035


def test_baselayers_and_overlays_added(catalog_output_folder):
collection_name = "imperviousness_density_2018"
root_collection_path = os.path.join(catalog_output_folder, collection_name)
Expand Down
1 change: 1 addition & 0 deletions tests/testing-indicators/test_indicator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Name: test_indicator_grouping_collections
Title: test_indicator_grouping_collections
EodashIdentifier: test_indicator_1
Description: 'test_indicator_1_description'
MapProjection: 3035
Collections:
- test_tif_demo_1
- test_tif_demo_2

0 comments on commit 6b97c97

Please sign in to comment.