1

I'm trying to generate random points at a specific density within a polygon layer. The polygon layer has 1850 features and I'm looking to have random points within each feature at 1/meter. Going through Vector -> Research tool -> Random points -> "Use this density of points" = 1 (assuming the default is based on unit of the project) -> Save As: .shp -> click OK. The OK button darkens, then lightens to normal without producing any result.

I've also tried going through the Processing Toolbox -> QGIS geoalgo -> Vect Creation Tools -> Random points inside polygons (fixed), set density = 1, and get error:

"Algorithm Random points inside polygons (fixed) starting...

float division by zero See log for more details"

Any ideas? I think it has something to do with the density parameter, but I haven't found what the unit used for the density is. Insight welcomed.

QGIS 2.14.3-Essen

4
  • Does this work: gis.stackexchange.com/questions/16830/dot-density-maps-in-qgis Commented Jul 7, 2016 at 0:14
  • Nah. The answer to that post contains an image of the tool I tried through Research Tools. Doesn't even think about running a process. And I am trying to make new points that are contained within polygons; not use information from existing attributes. But thanks!
    – Scolopax
    Commented Jul 7, 2016 at 0:57
  • Gotcha! Hmmm.... Commented Jul 7, 2016 at 1:08
  • Is your polygon layer valid? A division by zero can occur when there is invalid geometries.
    – romainbh
    Commented Jul 7, 2016 at 9:08

1 Answer 1

2

I've had a similar problem and I think it's due to the way that QGIS calculates the number of points when using density. It is rounding the density * polygon area for each polygon. So if that value is < 0.5 for any of your polygons, QGIS will round this to 0 and then you'll get a divide by 0 error.

For example:

Say you choose a density of 0.01. If you have a polygon with an area of 49, then 49 * 0.01 = 0.49. QGIS will then round this down to 0.

The solution for me was to remove the polygons that were smaller than this, then re-add them afterwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.