Skip to content

Commit

Permalink
Allow intersects search to use GeometryCollection (#548)
Browse files Browse the repository at this point in the history
* Include GeometryCollection as a valid input type ; queries can now be made with a GeometryCollection type to the 'intersects' query without raising a 400 error; has not been tested to show that the intersection is correct

* Fix format problems to satisfy black

* Add tests

* Whoops, formatting

* Update changelog

* update changelog

---------

Co-authored-by: vincentsarago <[email protected]>
  • Loading branch information
jpolchlo and vincentsarago authored Apr 10, 2024
1 parent 6e74b21 commit 53711ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Improve bbox and datetime typing ([#490](https://github.com/stac-utils/stac-fastapi/pull/490)
* Add `items` link to inferred link relations ([#634](https://github.com/stac-utils/stac-fastapi/issues/634))
* Make sure FastAPI uses Pydantic validation and serialization by not wrapping endpoint output with a Response object ([#650](https://github.com/stac-utils/stac-fastapi/pull/650))
* Allow `GeometryCollections` for `intersects` parameter in POST search queries ([#548](https://github.com/stac-utils/stac-fastapi/pull/548))

### Removed

Expand Down
11 changes: 10 additions & 1 deletion stac_fastapi/types/stac_fastapi/types/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import attr
from geojson_pydantic.geometries import (
GeometryCollection,
LineString,
MultiLineString,
MultiPoint,
Expand Down Expand Up @@ -127,7 +128,15 @@ class BaseSearchPostRequest(BaseModel):
ids: Optional[List[str]]
bbox: Optional[BBox]
intersects: Optional[
Union[Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon]
Union[
Point,
MultiPoint,
LineString,
MultiLineString,
Polygon,
MultiPolygon,
GeometryCollection,
]
]
datetime: Optional[DateTimeType]
limit: Optional[Limit] = Field(default=10)
Expand Down

0 comments on commit 53711ec

Please sign in to comment.