## Tuesday, August 24, 2021

### Extrapolating Nigeria population by states, LGAs and wards from WorldPop database

On WorldPop.org you will find open and high-resolution geospatial data on population distributions, demographic and dynamics, with a focus on low and middle income countries.

In this article, I will explain how to get population counts for states, LGAs and wards in Nigeria. More specifically, I will use the "Constrained Individual countries 2020 UN adjusted  (100m resolution) for Nigeria".

Download the data which is in raster GeoTif format and about 59mb at the time of writing. The load the population raster together with states, LGAs and wards polygon shapefiles into QGIS project.

As seen above, the darker dots are where we have higher concentration of people (high population). Now we need to extract the pixel population values for each state, LGA and ward.

Zonal statistics algorithm

Zonal statistics which is an algorithm that calculates statistics of a raster layer for each feature of an overlapping polygon vector layer. This algorithm can be accessed from the: Processing toolbox >>  Raster analysis >> Zonal statistics.

We will use this algorithm to calculate the sum of population value within each state, LGA and ward.

So, we just need to run the algorithm for the three polygon layers (state, LGA and ward).

The statistic to calculate is the 'sum'. Which is the sum of all pixel values with a polygon feature. After running the algorithm you should get population sum in decimal, use the round() function to round it to whole number.

There are some polygon especially in the ward layer (such as the one below) that will not have population count because there pixel value.

We can verify the population count by checking the total sum using 'Basic statistics for fields' as seen below as 205,960,851 population. This figure is close to the estimate population of Nigeria.

With this, we can calculate population density for every state. LGA or ward.

That is it!