Tuesday 16 February 2016

QGIS select by location failing




I'm performing a simple select by location. I want to select polygons from TQ_Building that fall within rapidair_AOI, a larger polygon. My workspace looks like this:


enter image description here


I'm using QGIS 2.18.13. I've performed this through the Vector > Research Tools > Select by location menu, and through the python console (see code below) but no selection is made and a dialog box with 'unknown See log for more details' appears.



import processing
mapcanvas = iface.mapCanvas()
layers = mapcanvas.layers()
processing.runalg('qgis:selectbylocation',layers[1],layers[0],u'within',0,0)

The layers share the same CRS, they are enetered correctly as input and intersect layers in the code. Any help / suggestions?


UPDATE: following @GeoDatup pointing me to log, here's the log message:



Uncaught error while executing algorithm Traceback (most recent call last): File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\core\GeoAlgorithm.py", line 203, in execute self.processAlgorithm(progress) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\algs\qgis\SelectByLocation.py", line 93, in processAlgorithm index = vector.spatialindex(inputLayer) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\tools\vector.py", line 219, in spatialindex idx = QgsSpatialIndex(layer.getFeatures(request)) Exception: unknown




UPDATE 2017-11-03


The above was running QGIS 2.18.13 on Windows 2012 r2 server. I have also tried to replicate on my local Dell machine with the following results:


enter image description here


But there's no selection made in the mapviewer (which is what we'd expect given the second 0 parameter in the selectbylocation algorithm) and no extra polygons in the rapidair_AOI layer (used for the intersection enyway).




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...