Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix iteration of features
  • Loading branch information
ahuarte47 committed Nov 10, 2016
1 parent 10648df commit dc800db
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py
Expand Up @@ -70,7 +70,6 @@ def processAlgorithm(self, progress):
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.fields().toList(), geomType, layer.crs())

inFeat = QgsFeature()
outFeat = QgsFeature()
inGeom = QgsGeometry()

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

features = vector.features(layer)
current = 0
total = 100.0 / (len(features))

features = vector.features(layer)
for inFeat in features:
atMap = inFeat.attributes()
total = 100.0 / len(features)
for current, feature in enumerate(features):
atMap = feature.attributes()
idVar = atMap[index]
key = str(idVar).strip()
if not key in collection_geom:
collection_geom[key] = []
collection_attrs[key] = atMap

inGeom = inFeat.geometry()
vType = inGeom.type()
inGeom = feature.geometry()
collection_geom[key].append(inGeom)

current += 1
progress.setPercentage(int(current * total))

for key, geoms in collection_geom.items():
Expand Down

0 comments on commit dc800db

Please sign in to comment.