Skip to content

Commit ae59b73

Browse files
committedApr 10, 2016
[processing] Use unary union in dissolve (much faster for many
complex geometry inputs)
1 parent 7d235d2 commit ae59b73

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
@@ -164,18 +164,11 @@ def processAlgorithm(self, progress):
164164
for key, value in myDict.items():
165165
nElement += 1
166166
progress.setPercentage(int(nElement * 100 / nFeat))
167-
for i in range(len(value)):
168-
tmpInGeom = value[i]
169-
170-
if i == 0:
171-
tmpOutGeom = tmpInGeom
172-
else:
173-
try:
174-
tmpOutGeom = QgsGeometry(
175-
tmpOutGeom.combine(tmpInGeom))
176-
except:
177-
raise GeoAlgorithmExecutionException(
178-
self.tr('Geometry exception while dissolving'))
167+
try:
168+
tmpOutGeom = QgsGeometry.unaryUnion(value)
169+
except:
170+
raise GeoAlgorithmExecutionException(
171+
self.tr('Geometry exception while dissolving'))
179172
outFeat.setGeometry(tmpOutGeom)
180173
outFeat.setAttributes(attrDict[key])
181174
writer.addFeature(outFeat)

0 commit comments

Comments
 (0)
Please sign in to comment.