From aa147662cfe71ec515a76f76c6f22a2bdc206381 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Thu, 26 Feb 2026 09:19:21 -0500 Subject: [PATCH 1/2] add: failing tests --- tests/routes/test_items.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/routes/test_items.py b/tests/routes/test_items.py index 304a355d..dbec58c1 100644 --- a/tests/routes/test_items.py +++ b/tests/routes/test_items.py @@ -390,10 +390,20 @@ def test_items_geo_filter_cql2(app): Items.model_validate(body) -def test_items_geo_filter_cql2_non_4326_crs(app): +def test_items_geo_filte_non_4326_crs(app): """Test CQL2 non 4326 geo filter.""" response = app.get( - "/collections/public.minnesota/items?filter-lang=cql2-text&filter=S_INTERSECTS(geom, POLYGON((-95.5389899 47.5578719,-95.5018943 46.4902864,-94.1637708 46.4891952,-94.1277889 47.5804373,-95.5389899 47.5578719)))" + "/collections/public.minnesota/items?filter-lang=cql2-text&filter=S_INTERSECTS(geom, POLYGON((-95.5389899 46.4902864, -94.1637708 46.4902864, -94.1637708 47.5804373, -95.5389899 47.5804373, -95.5389899 46.4902864)))" + ) + + assert response.status_code == 200 + body = response.json() + assert len(body["features"]) == 2 + assert body["numberMatched"] == 2 + Items.model_validate(body) + + response = app.get( + "/collections/public.minnesota/items?bbox=-95.5389899,46.4902864,-94.1637708,47.5804373" ) assert response.status_code == 200 From 97a7e6612a9b0746122b6e5bce3c5929deeade40 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Thu, 26 Feb 2026 09:42:31 -0500 Subject: [PATCH 2/2] fix: bbox filtering for non-epsg4326 geometries --- CHANGES.md | 7 ++++++- tipg/collections.py | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e1d22aaf..13590ab1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,10 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin ## [unreleased] +## [1.3.1] - 2026-02-26 + +* fix: bbox filter when collection's geometry is not in EPSG:4326 CRS + ## [1.3.0] - 2025-11-17 * switch to official python docker image from `bitnami` @@ -425,7 +429,8 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin - Initial release -[unreleased]: https://github.com/developmentseed/tipg/compare/1.3.0...HEAD +[unreleased]: https://github.com/developmentseed/tipg/compare/1.3.1...HEAD +[1.3.1]: https://github.com/developmentseed/tipg/compare/1.3.0...1.3.1 [1.3.0]: https://github.com/developmentseed/tipg/compare/1.2.1...1.3.0 [1.2.1]: https://github.com/developmentseed/tipg/compare/1.2.0...1.2.1 [1.2.0]: https://github.com/developmentseed/tipg/compare/1.1.2...1.2.0 diff --git a/tipg/collections.py b/tipg/collections.py index 82d61169..054f2cf5 100644 --- a/tipg/collections.py +++ b/tipg/collections.py @@ -570,8 +570,12 @@ def _where( # noqa: C901 wheres.append( logic.Func( "ST_Intersects", - logic.S(bbox_to_wkt(bbox)), logic.V(geometry_column.name), + logic.Func( + "ST_Transform", + logic.S(bbox_to_wkt(bbox)), + logic.Func("ST_SRID", logic.V(geometry_column.name)), + ), ) )