1

I am using the latest version of QGIS 3.6.3 and I am getting the same error regardless of what I do when trying to run the Create Random Points in Layer Bounds tool. Here is the error:

QGIS version: 3.6.3-Noosa
QGIS code revision: 0c5774c068
Qt version: 5.11.2
GDAL version: 2.4.1
GEOS version: 3.7.2-CAPI-1.11.0 b55d2125
PROJ version: 520
Processing algorithm…
Algorithm 'Random points in layer bounds' starting…
Input parameters:
{ 'INPUT' : 'C:/Users/Noah/Desktop/PGWork/CollinCounty/Working/AOI_Dissolve.shp', 'MIN_DISTANCE' : 0, 'OUTPUT' : 'TEMPORARY_OUTPUT', 'POINTS_NUMBER' : 1500 }

Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.6/apps/qgis/./python/plugins\processing\algs\qgis\RandomPointsLayer.py", line 109, in processAlgorithm
sourceIndex = QgsSpatialIndex(source, feedback)
Exception: unknown

Execution failed after 0.05 seconds

Loading resulting layers
Algorithm 'Random points in layer bounds' finished

I have tried dissolving my shape file so that there is only one multipart feature, I have tried setting the project CRS to the CRS of the layer (I am using the NAD_1983_UTM_Zone_14N projection), I have tried saving the points as an actual shapefile instead of a temporary file, and I have tried removing and adding the spatial index through the Remove / Add Spatial Index tool in ArcMap and nothing works. Is there something wrong with the shapefile I am using? This only seems to be a problem with this newer version of QGIS. I remember using this tool before on multipart and multi feature shapefiles before and not having this issue.

  • 1
    check the validity of your polygons, next look at line 109 and see what it is doing – Ian Turton Jul 11 at 7:24
1

I wish Ian had posted his response as an answer so I could give him the rep, but I guess I will write it here for now. Looks like polygons must be valid before you can run this tool so his suggestion was the route to solving this issue. I didn't think coincident vertices would be an issue that would stop this tool but there were two errors like this that were identified when validating the geometry. After moving the vertices to no longer be coincident with another part of the geometry, I ran the tool and everything came out perfect. There was no need to see what was on line 109 that was tripping the error in this case (I was also having trouble finding it when trying to look at the QGIS API).

Either way, problem solved.

  • 1
    invalid polygons will always break an algorithm – Ian Turton Jul 12 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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