Skip to content
Permalink
Browse files

Fix "Random points along line" alg

Fixes "Random points along line" (qgis:randompointsalongline) algorithm
Fixes #33156
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Jan 31, 2020
1 parent c589bde commit 2788cc9c2a09ea027ef8b9b61f3d9480d86e56c6
Showing with 3 additions and 1 deletion.
  1. +3 −1 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
@@ -117,12 +117,14 @@ def processAlgorithm(self, parameters, context, feedback):

random.seed()

ids = source.allFeatureIds()

while nIterations < maxIterations and nPoints < pointCount:
if feedback.isCanceled():
break

# pick random feature
fid = random.randint(0, featureCount - 1)
fid = random.choice(ids)
f = next(source.getFeatures(request.setFilterFid(fid).setSubsetOfAttributes([])))
fGeom = f.geometry()

0 comments on commit 2788cc9

Please sign in to comment.
You can’t perform that action at this time.