Skip to content

Commit

Permalink
[processing] Fix non-sequential ids in regular points algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 15, 2018
1 parent f769430 commit 9d6b5a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/plugins/processing/algs/qgis/RegularPoints.py
Expand Up @@ -130,6 +130,7 @@ def processAlgorithm(self, parameters, context, feedback):
f.setFields(fields)

count = 0
id = 0
total = 100.0 / (area / pSpacing)
y = extent.yMaximum() - inset

Expand All @@ -151,10 +152,11 @@ def processAlgorithm(self, parameters, context, feedback):
geom = QgsGeometry().fromPointXY(QgsPointXY(x, y))

if extent_engine.intersects(geom.constGet()):
f.setAttribute('id', count)
f.setAttributes([id])
f.setGeometry(geom)
sink.addFeature(f, QgsFeatureSink.FastInsert)
x += pSpacing
id += 1

count += 1
feedback.setProgress(int(count * total))
Expand Down

0 comments on commit 9d6b5a7

Please sign in to comment.