Skip to content

Commit

Permalink
Merge pull request #30340 from qgis/backport-30331-to-release-3_8
Browse files Browse the repository at this point in the history
[Backport release-3_8] [processing] assign correct ids to features in the random points in polygons algorithm (fix #26321)
  • Loading branch information
alexbruy committed Jun 23, 2019
2 parents e637b9e + 013b92d commit e611515
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/plugins/processing/algs/qgis/RandomPointsPolygons.py
Expand Up @@ -135,6 +135,7 @@ def processAlgorithm(self, parameters, context, feedback):

total = 100.0 / source.featureCount() if source.featureCount() else 0
current_progress = 0
pointId = 0
for current, f in enumerate(source.getFeatures()):
if feedback.isCanceled():
break
Expand Down Expand Up @@ -190,12 +191,13 @@ def processAlgorithm(self, parameters, context, feedback):
f = QgsFeature(nPoints)
f.initAttributes(1)
f.setFields(fields)
f.setAttribute('id', nPoints)
f.setAttribute('id', pointId)
f.setGeometry(geom)
sink.addFeature(f, QgsFeatureSink.FastInsert)
index.addFeature(f)
points[nPoints] = p
nPoints += 1
pointId += 1
feedback.setProgress(current_progress + int(nPoints * feature_total))
nIterations += 1

Expand Down

0 comments on commit e611515

Please sign in to comment.