Thanks for the full answer Richard, and the brain baffling eye-candy. Previously I have used the manual approach of generating a regular grid at the required resolution (R) and adding a random x,y (scaled max R) to each co-ord, which is tricky when you have a required sample per polygon. Alternatively, generating a dense regular grid, adding a random 0-9 column, sorting by ID&random and skimming the required sample off the top. This 'appears' more random.
Regards, Chris Chris Berens www.mapland.co.za +27 (0)82 567 9322 On 19 February 2015 at 21:32, Richard Duivenvoorde <[email protected]> wrote: > On 19-02-15 19:54, Chris Berens wrote: >> Hi all, >> >> The random points I generate inside polygons with QGIS always seem to >> follow lines. This is also evident on the Linfiniti manual example of >> same: >> http://manual.linfiniti.com/en/vector_analysis/spatial_statistics.html >> Is there a reason for this? > > Hi Chris, > > I do not see 'lines', but I do see some 'flocking'... > It all depends on the algorithm used: > > https://github.com/qgis/QGIS/blob/master/python/plugins/fTools/tools/doRandPoints.py#L154-L170 > > not sure if you can deduct what is the 'problem' there. > > For a plugin I created for a client: Feature Grid Plugin (to create a > regular grid of points in a polygon for small work plots), I had a look > into some algorithms to create a given number of points in a polygon > which are random but also fill up the space at best. The best algorithm > to use (and is very nice to look at) comes from > http://bost.ocks.org/mike/algorithms/ <== look at those !!! > and is called 'Poisson-disc: > http://www.jasondavies.com/poisson-disc/ > > If people are interested I think it is nice to either add this to ftools > or to my own plugin. > > Regards, > > Richard > _______________________________________________ > Qgis-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-user > _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
