Is there a way to perform spatial queries on multiple layers in QGIS without going through an external database? I would like to perform SQL-like queries on layers imported in QGIS directly, but can't find a way to do so!

Basically, what I want is to do a "Select * From layer1 INTERSECT Select * From layer2 Where CONDITION"

I understand I can manually select features from a layer and then do a spatial query while checking the "use selected features" box, but I'd rather do everything in a query, as I have a lot to do and prefer not to fiddle with buttons.

The refFunctions proposed works great, but involves the field calculator; is there a way to simply select the features instead of modifying a table?

Maybe it's simply not possible directly.

1 Answer 1


I'm not entirely sure what you're asking here. If you just want to do an intersect on only selected features, just select those you want from each layer and check the option to use selected features only in the intersect dialog. If your condition involves attributes of another layer, use the refFunctions plugin within the field calculator and build your expression from there.

  • Indeed, I forgot to mention this. Yes, I know I can work manually on this (selecting features and check the "use selected features" box), but I would rather do this using queries, so I don't have to fiddle between screens and buttons, as I have a lot of operations of this type to do!
    – Horizen
    Commented Feb 28, 2016 at 21:28

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.