Skip to content
Permalink
Browse files

[processing] fixed simplify geometries

  • Loading branch information
volaya committed Oct 27, 2016
1 parent 530bf51 commit bf6607f09af38009261ea00d8480dc87094ec26d
Showing with 11 additions and 10 deletions.
  1. +11 −10 python/plugins/processing/algs/qgis/SimplifyGeometries.py
@@ -75,15 +75,16 @@ def processAlgorithm(self, progress):
features = vector.features(layer)
total = 100.0 / len(features)
for current, f in enumerate(features):
featGeometry = QgsGeometry(f.geometry())
attrs = f.attributes()
pointsBefore += self.geomVertexCount(featGeometry)
newGeometry = featGeometry.simplify(tolerance)
pointsAfter += self.geomVertexCount(newGeometry)
feature = QgsFeature()
feature.setGeometry(newGeometry)
feature.setAttributes(attrs)
writer.addFeature(feature)
featGeometry = f.geometry()
if featGeometry is not None:
attrs = f.attributes()
pointsBefore += self.geomVertexCount(featGeometry)
newGeometry = featGeometry.simplify(tolerance)
pointsAfter += self.geomVertexCount(newGeometry)
feature = QgsFeature()
feature.setGeometry(newGeometry)
feature.setAttributes(attrs)
writer.addFeature(feature)
progress.setPercentage(int(current * total))

del writer
@@ -114,4 +115,4 @@ def geomVertexCount(self, geometry):

return len(points)
else:
return None
return 0

0 comments on commit bf6607f

Please sign in to comment.
You can’t perform that action at this time.