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:
		
							parent
							
								
									20c9950b7f
								
							
						
					
					
						commit
						e6c0d8b1cf
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -2,10 +2,19 @@
 | 
			
		||||
<div class="col-sm-12">
 | 
			
		||||
    <div class="card">
 | 
			
		||||
        <div class="card-header rlp-r">
 | 
			
		||||
            <h5>
 | 
			
		||||
                {% fa5_icon 'search-location' %}
 | 
			
		||||
                {% trans 'Spatial reference' %}
 | 
			
		||||
            </h5>
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col-6">
 | 
			
		||||
                    <h5>
 | 
			
		||||
                        {% fa5_icon 'search-location' %}
 | 
			
		||||
                        {% trans 'Spatial reference' %}
 | 
			
		||||
                    </h5>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-6 text-right">
 | 
			
		||||
                    <h5>
 | 
			
		||||
                        {{ obj.geometry.geom.area|floatformat:2 }} m²
 | 
			
		||||
                    </h5>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="card-body">
 | 
			
		||||
            <div hx-trigger="load, every 5s" hx-get="{% url 'geometry-parcels' geom_form.instance.geometry.id %}">
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user