Hotfix
* fixes bug where None-geometry entry (instead of empty geometry) would not be expected on parcel fetching
This commit is contained in:
		
							parent
							
								
									029b9cf794
								
							
						
					
					
						commit
						b24e461e06
					
				@ -5,11 +5,13 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
 | 
				
			|||||||
Created on: 19.08.22
 | 
					Created on: 19.08.22
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					from django.contrib.gis.geos import MultiPolygon
 | 
				
			||||||
from django.http import HttpResponse, HttpRequest
 | 
					from django.http import HttpResponse, HttpRequest
 | 
				
			||||||
from django.shortcuts import get_object_or_404
 | 
					from django.shortcuts import get_object_or_404
 | 
				
			||||||
from django.template.loader import render_to_string
 | 
					from django.template.loader import render_to_string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from konova.models import Geometry, Municipal
 | 
					from konova.models import Geometry, Municipal
 | 
				
			||||||
 | 
					from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_geom_parcels(request: HttpRequest, id: str):
 | 
					def get_geom_parcels(request: HttpRequest, id: str):
 | 
				
			||||||
@ -30,7 +32,7 @@ def get_geom_parcels(request: HttpRequest, id: str):
 | 
				
			|||||||
    template = "konova/includes/parcels/parcel_table_frame.html"
 | 
					    template = "konova/includes/parcels/parcel_table_frame.html"
 | 
				
			||||||
    geom = get_object_or_404(Geometry, id=id)
 | 
					    geom = get_object_or_404(Geometry, id=id)
 | 
				
			||||||
    parcels = geom.get_underlying_parcels()
 | 
					    parcels = geom.get_underlying_parcels()
 | 
				
			||||||
    geos_geom = geom.geom
 | 
					    geos_geom = geom.geom or MultiPolygon(srid=DEFAULT_SRID_RLP)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    geometry_exists = not geos_geom.empty
 | 
					    geometry_exists = not geos_geom.empty
 | 
				
			||||||
    parcels_are_currently_calculated = geometry_exists and geos_geom.area > 0 and len(parcels) == 0
 | 
					    parcels_are_currently_calculated = geometry_exists and geos_geom.area > 0 and len(parcels) == 0
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user