From 0b4b6642652c4b4b072c77075dad200b3a7b74fd Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 11 May 2022 16:03:53 +0200 Subject: [PATCH] #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 --- konova/utils/wfs/spatial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/konova/utils/wfs/spatial.py b/konova/utils/wfs/spatial.py index 2f1452d..e6cae84 100644 --- a/konova/utils/wfs/spatial.py +++ b/konova/utils/wfs/spatial.py @@ -11,7 +11,7 @@ from json import JSONDecodeError from time import sleep 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 konova.settings import DEFAULT_SRID_RLP, PARCEL_WFS_USER, PARCEL_WFS_PW, PROXIES @@ -91,7 +91,7 @@ class ParcelWFSFetcher(AbstractWFSFetcher): ).annotate( transformed=Transform(srid=filter_srid, expression="geom") ).annotate( - gml=AsGML('transformed') + gml=AsGML(MakeValid('transformed')) ).first().gml spatial_filter = f"<{geometry_operation}>{self.geometry_property_name}{geom_gml}" return spatial_filter