Skip to content
Permalink
Browse files
[processing] check difference result befor using it in further
operations (ref #15962)
  • Loading branch information
alexbruy committed May 13, 2017
1 parent 02c8ac8 commit bc4e70a0e23af98ab9fa416856b5a44b007b23f2
Showing with 10 additions and 1 deletion.
  1. +10 −1 python/plugins/processing/algs/qgis/Union.py
@@ -75,7 +75,8 @@ def processAlgorithm(self, progress):
geomType = vlayerA.wkbType()
fields = vector.combineVectorFields(vlayerA, vlayerB)
writer = self.getOutputFromName(Union.OUTPUT).getVectorWriter(fields,
geomType, vlayerA.crs())
geomType,
vlayerA.crs())
inFeatA = QgsFeature()
inFeatB = QgsFeature()
outFeat = QgsFeature()
@@ -161,6 +162,10 @@ def processAlgorithm(self, progress):
if len(lstIntersectingB) != 0:
intB = QgsGeometry.unaryUnion(lstIntersectingB)
diff_geom = diff_geom.difference(intB)
if diff_geom is None:
ProcessingLog.addToLog(ProcessingLog.LOG_INFO,
self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))
diff_geom = QgsGeometry()
if diff_geom.isGeosEmpty() or not diff_geom.isGeosValid():
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))
@@ -207,6 +212,10 @@ def processAlgorithm(self, progress):
else:
intA = QgsGeometry.unaryUnion(lstIntersectingA)
res_geom = geom.difference(intA)
if res_geom is None:
ProcessingLog.addToLog(ProcessingLog.LOG_INFO,
self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))
res_geom = QgsGeometry()
if res_geom.isGeosEmpty() or not res_geom.isGeosValid():
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))

0 comments on commit bc4e70a

Please sign in to comment.