I'm quite new to QGIS.

I have one layer that is a quadratic grid with a different population in each square, and I have another layer with two polygons that I got from the Travel Time plugin. I want to calculate how large a population each travel time polygon covers. I have done it when there is no overlapping between two polygons by using Spatial Join in MMQGIS.

However, I don’t know how to do this when there is overlap between the polygons. When there is overlap, I want to split the population evenly between the polygons. I also want to be able to do this when there are more than two overlapping polygons.

Do you know how to do this?

  • 1
    The people who specialize in population are quite insistent (rightly so) that you not try to disaggregate their population values. Human habitation is rarely uniform, so extreme care should be taken when allocating values and documenting results.
    – Vince
    Aug 13, 2021 at 14:26

1 Answer 1

  1. On the grid-layer, create an attribute for each of the polygons that counts for each grid-cell which of the polygons overlaps. Use this expression, replacing poly1 with the names of the polygons: if (overlay_intersects( 'poly1'), 1,0). Repeat this step for each of the polygons.

  2. Create the sum of the polygons that overlap each cell creating a field poly_all, adding all the attribute fields created before (like: poly1 + poly2 + poly3). See the resulting number (from 0 to 3) as label in the grid on the following screenshot.

  3. Now calculate the population for each polygon in every grid-cell: it corresponds to 0 (no overlap), the whole population number (only this polygon overlaps) or a fraction of the whole population, depending on how many polygons overlap this cell. Use an expression like this: population / poly_all * poly1 and repeat this for each of the overlapping polygons. You get the no. of population to be calculated for each polygon, called pop1, pop2, pop3 in the screenshot.

  4. Now calculate the sum of pop1, pop2, pop3 with this expression: sum( pop1).

Screenshot: each cell with the number of overlapping polygons: enter image description here

  • Thank you! That was very helpful and made it easier for me to think about this. I would like to do this automatically for several different polygons though. I have about 3000 polygons, and millions of grid-cells. The polygons overlap to a varying degree. Some polygons don’t overlap with another polygon at all, whereas other polygons may overlap with about 10 other polygons. So, if I use your approach, then I would need to create the attributes for each polygon that covers the cells automatically. Is there a way to do this in QGIS?
    – YoungGun
    Aug 17, 2021 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.