Skip to content

Commit f412187

Browse files
nyalldawsonalexbruy
authored andcommittedApr 10, 2016
[processing] Use unary union in dissolve (much faster for many
complex geometry inputs)
1 parent 510f602 commit f412187

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed
 

‎python/plugins/processing/algs/qgis/Dissolve.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,11 @@ def processAlgorithm(self, progress):
128128
for key, value in myDict.items():
129129
nElement += 1
130130
progress.setPercentage(int(nElement * 100 / nFeat))
131-
for i in range(len(value)):
132-
tmpInGeom = value[i]
133-
134-
if i == 0:
135-
tmpOutGeom = tmpInGeom
136-
else:
137-
try:
138-
tmpOutGeom = QgsGeometry(
139-
tmpOutGeom.combine(tmpInGeom))
140-
except:
141-
raise GeoAlgorithmExecutionException(
142-
self.tr('Geometry exception while dissolving'))
131+
try:
132+
tmpOutGeom = QgsGeometry.unaryUnion(value)
133+
except:
134+
raise GeoAlgorithmExecutionException(
135+
self.tr('Geometry exception while dissolving'))
143136
outFeat.setGeometry(tmpOutGeom)
144137
outFeat.setAttributes(attrDict[key])
145138
writer.addFeature(outFeat)

0 commit comments

Comments
 (0)
Please sign in to comment.