Could anyone explain to me how to run the 'select by location' algorithm in a QGIS 3.0 script? I find it really hard to understand the documentation about it. I found a lot of docs about how to write a processing script in QGIS 2.x but it doesn't seem to work like that in QGIS 3.0 anymore. This is what I got so far...

from qgis.core import *
import processing
points = QgsVectorLayer('points_layer_path')
poly = QgsVectorLayer('polygon_layer_path')
processing.run('native:selectbylocation', points, 2, poly, 0)

It's not much, I know, but shouldn't it work like this?

  • 1
    Welcome to GIS SE. As a new user, please take the Tour. Please Edit the question to more clearly explain the difference you are experiencing between revs. – Vince Jun 7 '18 at 21:22

Your Answer

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

Browse other questions tagged or ask your own question.