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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user