How do I generate five random points within each of three polygons with a minimum distance of 100m? I am using QGIS 2.18.4 and 'Random Points Inside Polygons (Fixed)' Sampling Strategy 'Point Count' 5 and min dist 100. I am currently only returning a single random point in each polygon rather than 5. There is plenty of space in each polygon to locate 5 points with >100m between. Additional information: Project and Polygon are EPSG:28356, unit set to meters.
[GIS] How to create multiple points inside polygon in QGIS
pointqgisqgis-processingrandom
Related Solutions
In ArcGIS, this can be done with Create random point if you have spatial analyst or 3D analyst or Advanced(ArcInfo) licence
select each shapefile as "constraining_feature_class" and set the "minimum_allowed_distance"to 250 m.
In QGIS, from what I know, you can use "Vector ‣ Research Tools ‣ Random points" with a constraining feature class, but not for distance. Again, you can use this tool in a loop to add points one by one until you reach the required number.
On the other hand, a solution for simple random sampling with distance contraint is to recursively add your random point and erase the buffer around your random point from the feature class until all your features are completely erased. As mentioned by @Whuber, this will not optimize the number of sample points, but you can control the number of points per strata.
Finally, the optimal number of points with a distance constraint can be achieved by systematic sampling : create a grid (with fishnet) with evenly spaced points (in your case 250 m) and randomly select a rotation angle and shift value betwen 0 and 250 in X and Y direction. This will optimize the number of point samples (and you could randomly subselect some points to reach a given number inside each startum). However, note that systematic sample could be biased because of the spatial autocorrelation.
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.
Best Answer
I would guess that your polygon layer originally was not saved with the EPSG:28356 CRS but that you set it manually.
Most likely the polygon layer was orignally saved with another CRS using degrees as units.
I did a quick test using polygons with a CRS of EPSG:4326 (i.e. using degrees as units) and using your exact parameters for the
Random Points Inside Polygons (Fixed)
tool:I then right-clicked the Polygons layer, chose the
Save As...
option, assigned a new CRS which uses meters (i.e. EPSG:28356) and again repeated the same steps. This is the result:So try saving your polygon layer into a new shapefile with the relevant CRS and run the tool again.