Map client holes fix

* fixes bug where holes in stored geometries would not be rendered properly on initial loading the map client
    * drawback: multiple polygons are treated as a single feature on the map client. Not a real issue but maybe we can find a better solution to this
* quality of life: renders geometry area in m² on detail and report view
This commit is contained in:
2022-10-14 08:02:08 +02:00
parent b57d52dc9f
commit d95827770d
2 changed files with 17 additions and 11 deletions

View File

@@ -213,12 +213,9 @@ class Geometry(BaseResource):
geojson (dict): The FeatureCollection json (as dict)
"""
geom = self.geom
geom.transform(ct=srid)
if geom.srid != srid:
geom.transform(ct=srid)
polygons = []
for coords in geom.coords:
p = Polygon(coords[0], srid=geom.srid)
polygons.append(p)
geojson = {
"type": "FeatureCollection",
"crs": {
@@ -230,8 +227,8 @@ class Geometry(BaseResource):
"features": [
{
"type": "Feature",
"geometry": json.loads(x.geojson)
} for x in polygons
"geometry": json.loads(geom.json),
}
]
}
return geojson