# Netgis client update

* integrates newest netgis map client
* generalizes map proxy response handling
This commit is contained in:
2024-11-21 13:46:35 +01:00
parent 6ff67d12c9
commit 457548da4d
6 changed files with 94 additions and 94 deletions

View File

@@ -48,9 +48,7 @@ class SimpleGeomForm(BaseForm):
raise AttributeError
geojson = self.instance.geometry.as_feature_collection(srid=DEFAULT_SRID_RLP)
geojson = self._set_editable_status(geojson)
geojson = self._set_properties(geojson, self.instance.identifier)
geom = json.dumps(geojson)
except AttributeError:
# If no geometry exists for this form, we simply set the value to None and zoom to the maximum level
@@ -227,7 +225,7 @@ class SimpleGeomForm(BaseForm):
geom = gdal.OGRGeometry(g_wkt)
return geom
def _set_editable_status(self, geojson: dict):
def _set_properties(self, geojson: dict, title: str):
""" Toggles the editable property of the geojson for proper handling in map client
Args:
@@ -238,7 +236,7 @@ class SimpleGeomForm(BaseForm):
"""
features = geojson.get("features", [])
for feature in features:
feature["properties"] = {
"editable": not self.read_only
}
feature["properties"]["editable"] = not self.read_only
if title:
feature["properties"]["title"] = title
return geojson