Skip to content

Commit

Permalink
[sextante]Fixed bug in dissolve tool
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Apr 21, 2013
1 parent 09e1aeb commit 51a9148
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions python/plugins/sextante/algs/ftools/Dissolve.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down Expand Up @@ -52,7 +53,6 @@ def processAlgorithm(self, progress):
fieldname = self.getParameterValue(Dissolve.FIELD)
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Dissolve.INPUT))
field = vlayerA.fieldNameIndex(fieldname)
GEOS_EXCEPT = True
vproviderA = vlayerA.dataProvider()
fields = vproviderA.fields()
writer = self.getOutputFromName(Dissolve.OUTPUT).getVectorWriter(fields, vproviderA.geometryType(), vproviderA.crs() )
Expand All @@ -77,8 +77,7 @@ def processAlgorithm(self, progress):
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
GEOS_EXCEPT = False
continue
raise GeoAlgorithmExecutionException("Geometry exception while dissolving")
outFeat.setAttributes( attrs )
writer.addFeature( outFeat )
else:
Expand All @@ -100,21 +99,18 @@ def processAlgorithm(self, progress):
outFeat.setGeometry( tmpInGeom )
first = False
attrs = inFeat.attributes()
else:
else:
tmpInGeom = QgsGeometry( inFeat.geometry() )
tmpOutGeom = QgsGeometry( outFeat.geometry() )
try:
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
GEOS_EXCEPT = False
add = False
tmpOutGeom = QgsGeometry( outFeat.geometry() )
try:
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
raise GeoAlgorithmExecutionException("Geometry exception while dissolving")
if add:
outFeat.setAttributes( attrs )
writer.addFeature( outFeat )
del writer
if not GEOS_EXCEPT:
SextanteLog.addToLog(SextanteLog.LOG_WARNING, "Geometry exception while dissolving")

def defineCharacteristics(self):
self.name = "Dissolve"
Expand Down

0 comments on commit 51a9148

Please sign in to comment.