Skip to content

Commit cc0b2e6

Browse files
authoredNov 10, 2016
Merge pull request #3746 from ahuarte47/Issue_SinglePartsToMultiparts
[FIXBUG] Fix iteration of features in SinglePartsToMultiparts algorithm
2 parents 10648df + dc800db commit cc0b2e6

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed
 

‎python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def processAlgorithm(self, progress):
7070
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
7171
layer.fields().toList(), geomType, layer.crs())
7272

73-
inFeat = QgsFeature()
7473
outFeat = QgsFeature()
7574
inGeom = QgsGeometry()
7675

@@ -80,23 +79,18 @@ def processAlgorithm(self, progress):
8079
collection_attrs = {}
8180

8281
features = vector.features(layer)
83-
current = 0
84-
total = 100.0 / (len(features))
85-
86-
features = vector.features(layer)
87-
for inFeat in features:
88-
atMap = inFeat.attributes()
82+
total = 100.0 / len(features)
83+
for current, feature in enumerate(features):
84+
atMap = feature.attributes()
8985
idVar = atMap[index]
9086
key = str(idVar).strip()
9187
if not key in collection_geom:
9288
collection_geom[key] = []
9389
collection_attrs[key] = atMap
9490

95-
inGeom = inFeat.geometry()
96-
vType = inGeom.type()
91+
inGeom = feature.geometry()
9792
collection_geom[key].append(inGeom)
9893

99-
current += 1
10094
progress.setPercentage(int(current * total))
10195

10296
for key, geoms in collection_geom.items():

0 commit comments

Comments
 (0)
Please sign in to comment.