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

POST search with intersects containing GeometryCollection fails with 400 #187

Closed
philvarner opened this issue Jul 19, 2021 · 5 comments · Fixed by #548
Closed

POST search with intersects containing GeometryCollection fails with 400 #187

philvarner opened this issue Jul 19, 2021 · 5 comments · Fixed by #548
Assignees
Labels
api layer spec Compliance with STAC/OGC specifications
Milestone

Comments

@philvarner
Copy link
Collaborator

According to the STAC API spec, all GeoJSON shape types must be supported by intersects. GeometryCollection is explicity defined in the openapi spec as one of these.

Running this search fails with a 400 error:

POST /search

{"intersects": { "type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [100.0, 0.0]}, {"type": "LineString", "coordinates": [[101.0, 0.0], [102.0, 1.0]]}]}}
@geospatial-jeff
Copy link
Collaborator

geospatial-jeff commented Jul 25, 2021

Thats interesting. My interpretation of the spec was that the search endpoint should only accept geojson geometry types, not any of the geometry containers. Here is the language in the stac api spec:

Searches items by performing intersection between their geometry and provided GeoJSON geometry. All GeoJSON geometry types must be supported.

And the GeoJSON spec says that the valid geometry types are Point, Line, Polygon, MultiPoint, MultiLine, and MultiPolygon. No mention of GeometryCollection.

Assuming that GeometryCollection is valid, I'm wondering what the expected behavior would be here. Return STAC Items that intersect with all geometries in the collection? Return items that intersect with any of the geometries? Return STAC items that intersect with the extent of the entire GeometryCollection?

@philvarner
Copy link
Collaborator Author

Your link to the GeoJSON spec has: GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

The semantics are intersection with any of the geometries in the geometry collection.

@geospatial-jeff
Copy link
Collaborator

wow I'm awful at reading 😆

The semantics are intersection with any of the geometries in the geometry collection.

👍

@jonhealy1
Copy link
Collaborator

I proposed this change in stac-pydantic to allow for GeometryCollections: stac-utils/stac-pydantic#102

lossyrob added a commit to microsoft/planetary-computer-apis that referenced this issue Jan 20, 2022
lossyrob added a commit to microsoft/planetary-computer-apis that referenced this issue Jan 20, 2022
* Remove erroneous stac_extensions on landing page

Can be removed once stac-utils/stac-fastapi#334 is fixed

* Allow search to state datetimes with date only

* Allow GeometryCollection

Can be removed when stac-utils/stac-fastapi#187 is closed

* Formatting

* Update CHANGELOG
@philvarner philvarner added the spec Compliance with STAC/OGC specifications label Mar 1, 2022
@geospatial-jeff
Copy link
Collaborator

geospatial-jeff commented Aug 4, 2022

Currently we aren't using the stac-pydantic search model (https://github.com/stac-utils/stac-fastapi/blob/master/stac_fastapi/types/stac_fastapi/types/search.py#L85-L86). But it looks like we could be using it from the docstring.

@gadomski gadomski self-assigned this Jan 31, 2023
@gadomski gadomski added this to the 2.4.4 milestone Jan 31, 2023
@gadomski gadomski modified the milestones: 2.4.4, 2.5.0 Mar 1, 2023
@gadomski gadomski assigned jpolchlo and unassigned gadomski Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api layer spec Compliance with STAC/OGC specifications
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants