Inverse Distance Weighting (IDW) is a geostatistical method designed to interpolate unknown values of a spatial variable at specific locations based on known values at surrounding points. The fundamental idea behind IDW follows Tobler’s first law of geography, which says that ‘Everything is related to everything else, but near things are more related than distant things’. Namely, the closer a spatial unit with a known value is to the spatial unit with an unknown value, the higher its influence on the interpolated value.
In this article, we test the IDW method to infer missing country-level population density levels using Africa as an example. For this, I use a world map enriched by population estimates and curated by Natural Earth (more on the public availability of the data here), then artificially erase several data points, which I infer using IDW. Finally, I compare the original and the inferred values of the erased population densities.
All images were created by the author.
Here, I am going to rely on GeoPandas’ built-in map dataset, ‘naturalearth_lowres.’ This is a global map sourced by Natural Earth and enriched by country-level…