Skip to content
Permalink
Browse files

Small refinement to multipart to singlepart alg

  • Loading branch information
nyalldawson committed Nov 2, 2016
1 parent 963d75f commit a44ea22880a497db920b8130f3e8afa27a8e273b
Showing with 3 additions and 4 deletions.
  1. +3 −4 python/plugins/processing/algs/qgis/MultipartToSingleparts.py
@@ -68,13 +68,12 @@ def processAlgorithm(self, progress):
input_geometry = f.geometry()
if input_geometry:
if input_geometry.isMultipart():
for i in range(input_geometry.geometry().numGeometries()):
singlepart_geometry = QgsGeometry(input_geometry.geometry().geometryN(i).clone())
for g in input_geometry.asGeometryCollection():
output_feature = f
output_feature.setGeometry( singlepart_geometry )
output_feature.setGeometry(g)
writer.addFeature(output_feature)
else:
writer.addFeature(f)
writer.addFeature(f)
else:
#input feature with null geometry
writer.addFeature(f)

0 comments on commit a44ea22

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