From fb75467c6f12dffd6a0a05e74ac2db567f04a8ed Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 17 Mar 2025 20:07:59 +0100 Subject: [PATCH] allow 3d bboxes --- CHANGES.md | 9 ++++++++- stac_fastapi/api/tests/test_models.py | 6 ++++++ stac_fastapi/types/stac_fastapi/types/search.py | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1de6162cc..2bba899c6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,12 @@ ## [Unreleased] +## [5.1.1] - 2025-03-17 + +### Fixed + +- allow bbox with 6 coordinates (3D) in `GET` requests + ## [5.1.0] - 2025-03-07 ### Added @@ -597,7 +603,8 @@ Full changelog: https://stac-utils.github.io/stac-fastapi/migrations/v3.0.0/#cha * First PyPi release! -[Unreleased]: +[Unreleased]: +[5.1.1]: [5.1.0]: [5.0.3]: [5.0.2]: diff --git a/stac_fastapi/api/tests/test_models.py b/stac_fastapi/api/tests/test_models.py index 283c79f7e..032b60026 100644 --- a/stac_fastapi/api/tests/test_models.py +++ b/stac_fastapi/api/tests/test_models.py @@ -40,6 +40,12 @@ def test_create_get_request_model(): assert d.microsecond == 10 assert not model.end_date + model = request_model(bbox="0,0,0,1,1,1") + assert model.bbox == (0.0, 0.0, 0.0, 1.0, 1.0, 1.0) + + with pytest.raises(AssertionError): + request_model(bbox="0,0,0,1,1") + model = request_model( datetime="2020-01-01T00:00:00.00001Z/2020-01-02T00:00:00.00001Z", ) diff --git a/stac_fastapi/types/stac_fastapi/types/search.py b/stac_fastapi/types/stac_fastapi/types/search.py index ea0a83818..7e35ad196 100644 --- a/stac_fastapi/types/stac_fastapi/types/search.py +++ b/stac_fastapi/types/stac_fastapi/types/search.py @@ -35,7 +35,7 @@ def str2bbox(x: str) -> Optional[BBox]: """Convert string to BBox based on , delimiter.""" if x: t = tuple(float(v) for v in str2list(x)) - assert len(t) == 4, f"BBox '{x}' must have 4 values." + assert len(t) in [4, 6], f"BBox '{x}' must have 4 or 6 values." return t return None