Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix "Random points along line" alg
Fixes "Random points along line" (qgis:randompointsalongline) algorithm
Fixes #33156
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Feb 3, 2020
1 parent c3898d9 commit e82ba52
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -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()

Expand Down

0 comments on commit e82ba52

Please sign in to comment.