[GIS] Use spatial queries on multiple layers in QGIS

layersqgisquery

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.

Best Answer

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.

Related Question