[GIS] Count Polygons in Polygons

countpolygonqgis

I have a layer of polygons that represent two specific zones withing a city. I want to get a count of the number of parcel polygons in another layer that are within the two specific zones I am interested in. Some of the boundaries of the two layers touch each other. Is there a way to get a count of parcels in each zone in QGIS?

I've tried doing a join attributes by location using the zones as the target layer and the parcels as the join layer. I used contains with a precision of 2 to try an account for the boundaries touching. I have the attribute summary as sum and Keep all records. The outcome is a shapefile but there is no sum of the number of parcels in each zone even though I have a count column in the parcel attribute table.

Is this the best way of going about this? IS there a way I could select using an expression from either attribute table?

EDIT:
Here are the images of the polygons and the Join dialogue box for the options I used:

Options for Join by Location

Best Answer

To find which parcel is located in which zone use the Intersection Tool under Vector-> Geoprocessing Tools with both layers as input layers.

The result is a layer, which contains every parcel (or part of it) which is inside the zone layer and the attribute table contains all attributes from both input layers.

Now you can either directly work with the intersection layer or split it with Vector-> Data Management Tools-> Split vector layer using the field which specifies the outer zone. Each of the new file now has directly the number of features which are located inside the corresponding zone.

Related Question