Quarters of the Earth's Population

A cartographic / infoviz experiment, dividing the world up into quarters - 4 areas of equal population.

For this, I used the SEDAC Gridded World Population raster. This gives a 2015 estimate of the population as  7,373,246,130 (7.37 billion)

This is quite a high-resolution raster, so I decided to apply a grid of 0.5 x 0.5 degrees. This was done in QGIS 2.16 using the Make Regular Grid (Polygons), then using Zonal Statistics to get the total population in each cell.

There are four maps - from the top

  • by longitude
  • by latitude
  • by great-circle distance from Shanghai
  • by great-circle distance from London

Interesting finds

  • the Western Hemisphere is home to less than 1/4 of the world's population
  • the same goes for the southern hemisphere

How this was done

I used postgres/postgis to do the query. I used shp2pgsql to import the 0.5 degree polygon grid (with summary stats) into a table called point5grid. The sum field contains the total population for that cell (or NULL if no-one lives there - which is a lot of places)

The challenging part for me was to find a way of creating a running total (cumulative total) of the population. The trick to this was the SUM(sum) OVER PARTION BY 1. I was originally going to do this in a spreadsheet, but was delighted to find it could be done in the query. This creates a field called cumpop which holds a running total from one row to the next - the order by must match the outer order-by clause :)

For the longitude version:-

create table ordered_xy as (
with
    a as (select * from point5grid)
select
    a.gid,
    a.geom,
    a.sum,
    sum(a.sum) OVER (
        PARTITION BY 1
        ORDER BY st_x(st_centroid(a.geom)) asc,
                          st_y(st_centroid(a.geom)) desc
    ) as cumpop
from
    a
order by
    st_x(st_centroid(a.geom)) asc,
    st_y(st_centroid(a.geom)) desc
);

The great distance versions are a bit more complex, but works on a similar principle.

The magic number 148748 is the gid of the cell I want to start in.. this is found in QGIS with the identify tool.

create table centered_uk_geoid as (
with
    a as (select * from point5grid where sum is not null),
    b as (select * from point5grid where gid = 148748)
select
    a.gid,
    a.geom,
    a.sum,
    st_distance_sphere(
        st_centroid(a.geom),
        st_centroid(b.geom)
    ) as dist,
    sum(a.sum) OVER (
        PARTITION BY 1
        ORDER BY st_distance_sphere(
            st_centroid(a.geom),
            st_centroid(b.geom)
        ) asc
    ) as cumpop
from
    a,b
order by
    st_distance(
        st_centroid(a.geom),
        st_centroid(b.geom)
    ) asc
);

Finally, this table is imported into QGIS, and styled using Rule-based rendering. Four bands are used, and colourised with the rule cumpop<X and cumpop is not null.  X is then set to multiples of 1/4 of the Earth's population for each successive band.

Being able to copy and paste styles between layers is a great help here!