Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] Use unary union in dissolve (much faster for many
complex geometry inputs)
  • Loading branch information
nyalldawson committed Apr 10, 2016
1 parent 7d235d2 commit ae59b73
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions python/plugins/processing/algs/qgis/Dissolve.py
Expand Up @@ -164,18 +164,11 @@ def processAlgorithm(self, progress):
for key, value in myDict.items():
nElement += 1
progress.setPercentage(int(nElement * 100 / nFeat))
for i in range(len(value)):
tmpInGeom = value[i]

if i == 0:
tmpOutGeom = tmpInGeom
else:
try:
tmpOutGeom = QgsGeometry(
tmpOutGeom.combine(tmpInGeom))
except:
raise GeoAlgorithmExecutionException(
self.tr('Geometry exception while dissolving'))
try:
tmpOutGeom = QgsGeometry.unaryUnion(value)
except:
raise GeoAlgorithmExecutionException(
self.tr('Geometry exception while dissolving'))
outFeat.setGeometry(tmpOutGeom)
outFeat.setAttributes(attrDict[key])
writer.addFeature(outFeat)
Expand Down

0 comments on commit ae59b73

Please sign in to comment.