From bb03e14387d8038eff889cad6513b23b6c791aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Vuilleumier?= Date: Fri, 15 Nov 2024 14:18:10 +0100 Subject: [PATCH] Read feature type BBOX from GET response --- geoservercloud/models/featuretype.py | 2 ++ tests/models/test_featuretype.py | 32 ++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/geoservercloud/models/featuretype.py b/geoservercloud/models/featuretype.py index ea35a47..2b761d4 100644 --- a/geoservercloud/models/featuretype.py +++ b/geoservercloud/models/featuretype.py @@ -140,6 +140,8 @@ def from_get_response_payload(cls, content: dict): projection_policy=feature_type["projectionPolicy"], service_configuration=feature_type["serviceConfiguration"], advertised=feature_type.get("advertised"), + native_bounding_box=feature_type.get("nativeBoundingBox"), + lat_lon_bounding_box=feature_type.get("latLonBoundingBox"), encode_measures=feature_type.get("encodeMeasures"), forced_decimals=feature_type.get("forcedDecimals"), simple_conversion_enabled=feature_type.get("simpleConversionEnabled"), diff --git a/tests/models/test_featuretype.py b/tests/models/test_featuretype.py index 1a7364e..100a112 100644 --- a/tests/models/test_featuretype.py +++ b/tests/models/test_featuretype.py @@ -134,7 +134,21 @@ def test_featuretype_from_get_response_payload(): "enabled": True, "advertised": True, "projectionPolicy": "FORCE_DECLARED", - "srs": "EPSG:4326", + "srs": "EPSG:2056", + "nativeBoundingBox": { + "minx": 2485014.052451379, + "maxx": 2837016.9329778464, + "miny": 1074188.6943776933, + "maxy": 1299782.763494124, + "crs": {"@class": "projected", "$": "EPSG:2056"}, + }, + "latLonBoundingBox": { + "minx": 5.902662003204146, + "maxx": 10.603307860867739, + "miny": 45.7779277267225, + "maxy": 47.8485348773655, + "crs": "EPSG:4326", + }, "title": "Test Title", "abstract": "Test Abstract", "keywords": {"string": ["keyword1", "keyword2"]}, @@ -176,7 +190,21 @@ def test_featuretype_from_get_response_payload(): assert feature_type.native_name == "test_native_name" assert feature_type.store_name == "test_store" assert feature_type.workspace_name == "test_workspace" - assert feature_type.srs == "EPSG:4326" + assert feature_type.srs == "EPSG:2056" + assert feature_type.native_bounding_box == { + "minx": 2485014.052451379, + "maxx": 2837016.9329778464, + "miny": 1074188.6943776933, + "maxy": 1299782.763494124, + "crs": {"@class": "projected", "$": "EPSG:2056"}, + } + assert feature_type.lat_lon_bounding_box == { + "minx": 5.902662003204146, + "maxx": 10.603307860867739, + "miny": 45.7779277267225, + "maxy": 47.8485348773655, + "crs": "EPSG:4326", + } assert feature_type.title.asdict()["title"] == "Test Title" assert feature_type.abstract.asdict()["abstract"] == "Test Abstract" assert feature_type.keywords == ["keyword1", "keyword2"]