[GIS] Select polygons by attribute belonging to another layer

qgisselectselect-by-location

I'm a recent QGIS user. I have a shapefile A with a series of polygons indicating land use of an urban region (urbanised areas). Now I want to select them in relation to a second shapefile B with the polygons administrative areas (municipalities). In other words, if polygons of shapefile A are inside the boundaries of municipality X they should be selected, and so on.
I tried Select by Location, but only managed to select the parts of shapefile A that intersect the whole of shapefile B (however there are many municipalities/polygons in that layer).
Hope this is clear to you! Thanks.

Best Answer

Depending on your desired output you can utilize 2 features of the Select by location tool in QGIS (Vector > Research Tools > Select by Location). In the image below you will see the options for 'use selected features only' and 'modify current select by...'.

In your example, first select your desired municipality polygon (from Shapefile B - you can do this manually or through a query) and then select 'use selected features only' when selecting your land cover polygons (Shapefile A) using the Select by location tool. This will result in only those land cover polygons being selected for a single municipality.

enter image description here

If desired you can then append additional selections using the 'add to current selection' option.

Related Question