Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HARMONY-1922: Add geometry to STAC item when bbox is defined, but geometry is not #49

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

indiejames
Copy link
Contributor

Jira Issue ID

HARMONY-1922

Description

the STAC spec requires a geometry if a STAC item has a bbox. This is now enforced by pystac. This change adds the
geometry field by creating a Polygon to match the bbox if there is a bbox, but not a geometry defined for the STAC item.

Local Test Steps

  1. Run make test
  2. Rebuild the harmony-service-example service image with this branch and deploy to your local environment. Verify that queries still work

PR Acceptance Checklist

  • Acceptance criteria met
  • Tests added/updated (if needed) and passing
  • Documentation updated (if needed)

is defined, but geometry is not
@@ -181,9 +181,13 @@ def _process_catalog_recursive(self, catalog):
result.clear_items()
source = None
for item in items:
cloned_item = item.clone()
# if there is a bbox, but no geometry, create a geometry from the bbox
if cloned_item.bbox and not cloned_item.geometry:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know why an item could have bbox, but no geometry?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harmony is creating them that way. Up until recently this didn't matter, but pystac started enforcing the spec, so we decided to add the geometry by duplicating the bbox as a polygon.

@indiejames indiejames merged commit 5eed2be into main Oct 17, 2024
8 checks passed
@indiejames indiejames deleted the harmony-1922 branch October 17, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants