Skip to content

Commit

Permalink
Read feature type BBOX from GET response
Browse files Browse the repository at this point in the history
  • Loading branch information
vuilleumierc committed Nov 15, 2024
1 parent 7774791 commit bb03e14
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions geoservercloud/models/featuretype.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
32 changes: 30 additions & 2 deletions tests/models/test_featuretype.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit bb03e14

Please sign in to comment.