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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def processAlgorithm(self, parameters, context, feedback):
f.setFields(fields) f.setFields(fields)


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


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


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


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

0 comments on commit 9d6b5a7

Please sign in to comment.