Skip to content

Commit

Permalink
Remove 501 usage from bbox handling
Browse files Browse the repository at this point in the history
  • Loading branch information
moradology committed Aug 18, 2021
1 parent 5016794 commit 8a410ae
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
5 changes: 0 additions & 5 deletions stac_fastapi/pgstac/stac_fastapi/pgstac/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ async def post_search(
Returns:
ItemCollection containing items which match the search criteria.
"""
if search_request.bbox and len(search_request.bbox) == 6:
raise HTTPException(
status_code=501,
detail="Support for 3D bounding boxes is not yet implemented",
)
item_collection = await self._search_base(search_request, **kwargs)
return ItemCollection(**item_collection)

Expand Down
4 changes: 0 additions & 4 deletions stac_fastapi/pgstac/tests/resources/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,10 +940,6 @@ async def test_search_bbox_errors(app_client):
resp = await app_client.post("/search", json=body)
assert resp.status_code == 400

params = {"bbox": "0,0,0,1,1,1"}
resp = await app_client.get("/search", params=params)
assert resp.status_code == 501

params = {"bbox": "100.0,0.0,0.0,105.0"}
resp = await app_client.get("/search", params=params)
assert resp.status_code == 400
14 changes: 9 additions & 5 deletions stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def get_search(
# Do the request
try:
search_request = SQLAlchemySTACSearch(**base_args)
except ValidationError:
except ValidationError as ve:
raise HTTPException(status_code=400, detail="Invalid parameters provided")
resp = self.post_search(search_request, request=kwargs["request"])

Expand Down Expand Up @@ -301,10 +301,14 @@ def post_search(
if len(search_request.bbox) == 4:
poly = ShapelyPolygon.from_bounds(*search_request.bbox)
elif len(search_request.bbox) == 6:
raise HTTPException(
status_code=501,
detail="Support for 3D bounding boxes is not yet implemented",
)
"""Shapely doesn't support 3d bounding boxes we'll just use the 2d portion"""
bbox_2d = [
search_request.bbox[0],
search_request.bbox[1],
search_request.bbox[3],
search_request.bbox[4],
]
poly = ShapelyPolygon.from_bounds(*bbox_2d)

if poly:
filter_geom = ga.shape.from_shape(poly, srid=4326)
Expand Down
4 changes: 0 additions & 4 deletions stac_fastapi/sqlalchemy/tests/resources/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,6 @@ def test_search_bbox_errors(app_client):
resp = app_client.post("/search", json=body)
assert resp.status_code == 400

params = {"bbox": "0,0,0,1,1,1"}
resp = app_client.get("/search", params=params)
assert resp.status_code == 501

params = {"bbox": "100.0,0.0,0.0,105.0"}
resp = app_client.get("/search", params=params)
assert resp.status_code == 400
Expand Down

0 comments on commit 8a410ae

Please # to comment.