QGIS – How to Count Population Within Polygons Using QGIS

populationqgis

I am really new with QGIS

I have a quadratic grid with different populations in each square and I have made polygons with the ORS plugin. The polygons cover some squares in full and some squares only partially. I need to count how much of the population is in each of the polygons. I am fine with assuming that the population is evenly spread within each square. I have tried to do that with MMQGIS, but I could not go further for my next step.

I am wondering if there is any other tool or way to do this. I hope to be able to do it automatically since I have to do it with lots of polygons.

Best Answer

This is a rather straightforward workflow heavily relying on the field calculator:

  1. Get the size of your grid cells, using $area in the field calculator (let's call this new field grid-area).
  2. Assign an ID to each of your polygons using $id in the field calculator (field ID).
  3. Use the vector tool intersect, the first input being your polygons, the second your grid. This combines overlapping geometries and assigns them the attributes of both geometries.
  4. Calculate the $area of your intersected polygons (call it e.g. area-new).
  5. Calculate the ratio between the area of the intersected polygons and the original grid cell using "area-new"/"grid-area".
  6. Multiply the population with the ratio (new field called pop-new).
  7. Create the sums for each polygon based on the pop-new field and the ID, using sum("pop-new","ID").
  8. If you want to clean everything up, you may use the dissolve-tool your intersected polygons based on the ID-field.