Category: GDAL

  • The Most Populated Circle on Earth (r = 20km)

    I love Tom Forth’s Population around a point website and have spent quite a bit of time there. I have often tried to find the most populated circle in certain countries but, obviously, it’s a crude way to go about it. That got me thinking, could I use convolution and NumPy to find the 20km r circle with the highest population on earth.

     

    Most populated r - 20km circle on earth
    Most populated r – 20km circle on earth

     

    Convolution slides a window over the raster and sums up what’s underneath it. Doing that pixel-by-pixel for a disc shape would be quite  slow, since it would be re-summing ~1,257 pixels at every single location on Earth. The workaround is to build the disc out of horizontal strips (each row of the circle has a width you can work out from basic circle geometry, and you sum each strip using a running cumulative sum instead of re-adding pixels every time). Stack the strips back together and you’ve got the exact disc sum, just much faster.

    I used the 2025 1km resolution Global Human Settlement Layer (GHSL) for the calculation and even on my M1 Mac, it only took about 2 minutes to run for the entire planet.

    The point that’s the centre of the r = 20km circle is here.


     

    One very important caveat is that there are limitations with how the dataset was created. The GHSL is not a direct headcount. It takes population totals and distributes them onto a (in this case) 1km population grid based on built-up areas. It’s essentially a (hopefully reasonably) accurate estimate.

  • Elevation Movie (2024)

    I was watching the movie Elevation (2024) last night on Amazon Prime. It was a decent movie with a great premise; the aliens/monsters couldn’t attack any humans that were above 8,000ft (2438.4m).

     

     

    I thought that would make a really interesting map so I downloaded the 60 Arc-Second bedrock elevation of the ETOPO 2022 dataset and used GDAL to filter it and create a cloud optimised geotiff. The results are below, amazing how the Tibetan Plateau stands in such stark relief.

    Due to limitations with the dataset (user guide here to learn more), it is missing some features (such as Galdhøpiggen in Norway).

    Full screen available here