At 3.18.3 I have a multipolygon Geopackage layer, EPSG:26910 (NAD83 UTM 10N), with 354 features, each containing between 1 and 70 constituent polygons.

I have used the Random Points in Polygons tool to create random points for every feature. The tool runs without reporting any errors, but it creates oddities in the output point layer.

Specifically, for many of the multipolygon features, no output points are assigned to one or more of the constituent polygons, with all points assigned to the other constituent polygon(s). Furthermore, the tool will never assign points to those constituent polygons, even if they are output to a singlepart layer with one single polygon. In other words, there is something unique about these "problem" constituent polygons that prevents QGIS from ever assigning them points.

Some screenshot examples:

Below is zoomed in to a portion of the entire multipolygon layer. Feature 2E_203_6_6400 is highlighted in green. Here, density-based points have been created, but all output points are allocated to one of the two constituent polygons. While this all-or-none allocation is theoretically possible, the odds of it happening are vanishingly small, particularly when it happens to many features in the same layer, and when it always happens (repeatedly) to the same "problem" polygons!

enter image description here

A shapefile zip of the above polygon layer is available at:


In the following screenshot, the "problem" constituent polygon from above has been output as single polygon. Interestingly, the Random Points in Polygons tool still refuses to allocate any points to this particular feature; the output point layer is empty.

enter image description here

Options that I've tried, with no effect:

  1. Store as either Geopackage layer or shapefile
  2. Store in either multipolygon or single polygon format
  3. Allocate points as either density-based or fixed value
  4. Alter the Random Seed value
  5. Fix Geometries, Repair Shapefiles, Check Validity tools

But wait, there's more!

When I use the Arc 10.8.1 Create Random Points tool with the same input multipolygon layer, random points are assigned to those polygons that QGIS will never assign.

This sure appears to be a QGIS bug, or am I overlooking something?

  • Suspect it is something like "create point on surface" which AFAIK is a feature in postgis but not in QGIS.
    – BJW
    Jun 5, 2021 at 22:45

1 Answer 1


Short answer

Apply a (very small) buffer > 0 (in my test, 0.1 meter worked fine). Then Random points in polygons for selected multipart feature generates points in all parts of the feature:

enter image description here

The buffered layer contains small overlaps. Depending on what you want to do, you should remove them (apply again a buffer of the same distance with negative value: -0.1 instead of 0.1) or just use the created point layer together with your original polygons.

In detail

Your polygons contain geomtry errors. See this example of the polygon-feature you used as an example in your question: I converted it to single parts and copied only the part that created you problems to a new layer. Using geometry checker plugin, I got this result: the polygon has a gap and contains a sliver

enter image description here

zoomed in to the spot highlighted above:

enter image description here

When I buffer this polygon by 0.1 meter, random points in polygons are assigned as expected. With a buffer of 0 (or using the original polygon), no points are created. So the problem is clearly caused by these geometry errors.

enter image description here

  • You are correct, and I thank you. There are two interesting aspects that I learned from this problem: first, ArcDesktop was more tolerant of input polygon errors than QGIS, since Arc created random points without complaint (whether or not that makes Arc a "better" choice for this issue is a separate discussion, I suppose. Perhaps Arc should have failed, given the input polygon errors!). Second, the QGIS Fix Geometries, Repair Shapefiles, and Check Validity tools that I used did not catch the input polygon errors, which could be seen as an indictment against them.
    – Stu Smith
    Jun 6, 2021 at 14:58
  • 1
    @Stu_Smith - I support both points, was exactly what I thought, too. Being more "tolerant" is great for avoiding headache, but can be dangerous as you will not be aware of possible problems. And it would indeed be great to see which kind of errors all the tools you mentioned + geometry checker can find and what their diference is: so when to use which tool. Maybe another question here? 3rd possible lesson: often a quick and dirty method (without identifying the actual problem) is to try the 0-buffer/almost-0-buffer solution to see if it helps, what is often the case.
    – Babel
    Jun 6, 2021 at 15:17

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.