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!
A shapefile zip of the above polygon layer is available at:
https://www.dropbox.com/s/ts3iysj9g7nmiu0/random_points_in_polygons_example.zip?dl=0
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.
Options that I've tried, with no effect:
- Store as either Geopackage layer or shapefile
- Store in either multipolygon or single polygon format
- Allocate points as either density-based or fixed value
- Alter the Random Seed value
- 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?