#160 Parcel calc fix

* fixes minor bug where invalid geometry (self intersecting) could not be used properly as input for WFS parcel intersection calculation
    * future enhancements regarding map client will make sure invalid geometries can not be added in the first place
This commit is contained in:
mpeltriaux 2022-05-11 16:03:53 +02:00
parent d1dc61cbd7
commit e73b7633a3

View File

@ -11,7 +11,7 @@ from json import JSONDecodeError
from time import sleep from time import sleep
import requests import requests
from django.contrib.gis.db.models.functions import AsGML, Transform from django.contrib.gis.db.models.functions import AsGML, Transform, MakeValid
from requests.auth import HTTPDigestAuth from requests.auth import HTTPDigestAuth
from konova.settings import DEFAULT_SRID_RLP, PARCEL_WFS_USER, PARCEL_WFS_PW, PROXIES from konova.settings import DEFAULT_SRID_RLP, PARCEL_WFS_USER, PARCEL_WFS_PW, PROXIES
@ -91,7 +91,7 @@ class ParcelWFSFetcher(AbstractWFSFetcher):
).annotate( ).annotate(
transformed=Transform(srid=filter_srid, expression="geom") transformed=Transform(srid=filter_srid, expression="geom")
).annotate( ).annotate(
gml=AsGML('transformed') gml=AsGML(MakeValid('transformed'))
).first().gml ).first().gml
spatial_filter = f"<Filter><{geometry_operation}><PropertyName>{self.geometry_property_name}</PropertyName>{geom_gml}</{geometry_operation}></Filter>" spatial_filter = f"<Filter><{geometry_operation}><PropertyName>{self.geometry_property_name}</PropertyName>{geom_gml}</{geometry_operation}></Filter>"
return spatial_filter return spatial_filter