Population Density Across Geographic Regions

Spatial analysis of population density across different map projections and geographic scales.

Source code: github.com/Chris010980/global_population_density

Global population density
Global population density highlighting urban–rural contrasts and major population centers.
Robinson projection (core logic)

  from src.common import reproject_raster, compute_extent

  data, transform = reproject_raster(src, dst_proj)
  extent = compute_extent(transform, data)

  ax.imshow(
      data,
      extent=extent,
      cmap=get_cmap_mpl(),
      norm=get_norm(),
  )
    
Global population density in orthographic projection
Global population density shown in an orthographic projection, preserving visual realism at the cost of global completeness.
Orthographic projection (Cartopy)

  proj = ccrs.Orthographic(central_longitude=10, central_latitude=50)

  ax = plt.axes(projection=proj)
  ax.set_global()

  ax.imshow(
      data,
      extent=[-180, 180, -90, 90],
      transform=ccrs.PlateCarree(),
      cmap=cmap,
      norm=norm
  )
    
Global population density in Mercator projection
Global population density in Mercator projection.
Area distortion increases with latitude: $A(\varphi) = 1/\cos^2\varphi$
Mercator reprojection

  dst_proj = CRS.from_proj4("+proj=merc +datum=WGS84 +units=m")

  data_merc, transform = reproject_raster(
      src,
      dst_proj,
      resolution=estimate_meter_resolution(src)
  )

  extent = compute_extent(transform, data_merc)
    

Processing Pipeline

Show pipeline

def main():
    check_files()

    generate_orthographic(data_path, output_ortho)

    generate_mercator(
        data_path,
        shapefile_path,
        output_mercator
    )

    generate_robinson(
        data_path,
        shapefile_path,
        output_robinson
    )
  

The workflow consists of raster preprocessing, reprojection, and consistent rendering across multiple map projections.

Shared utilities (reprojection)

def reproject_raster(src, dst_crs, resolution=None):
    transform, width, height = calculate_default_transform(
        src.crs, dst_crs, src.width, src.height, *src.bounds,
        resolution=resolution
    )

    data = np.empty((height, width), dtype=np.float32)

    reproject(
        source=src.read(1),
        destination=data,
        src_transform=src.transform,
        src_crs=src.crs,
        dst_transform=transform,
        dst_crs=dst_crs,
    )

    return data, transform
  

The Mercator Projection and Geometric Distortion

Any attempt to represent the Earth — a curved two-dimensional surface embedded in three-dimensional space — on a flat map inevitably introduces distortions. No map projection can preserve distances, angles, and areas simultaneously.

The Mercator projection is a conformal projection: it preserves local angles and shapes. This property makes it particularly useful for navigation, as rhumb lines (constant compass bearings) appear as straight lines. However, this comes at the cost of severe scale distortions toward the poles.

Vertical Stretching (Latitude Direction)

In the Mercator projection, geographic latitude $\varphi$ is mapped to a vertical coordinate

$$ y = R \ln\!\left(\tan\left(\frac{\pi}{4} + \frac{\varphi}{2}\right)\right), $$

which diverges as $|\varphi| \to 90^\circ$. As a consequence, distances between lines of latitude increase rapidly toward the poles, even though the actual spacing on the globe decreases.

Horizontal Stretching (Longitude Direction)

Although longitudes are mapped linearly in the horizontal direction, their effective scale increases with latitude. The local horizontal scale factor is

$$ k(\varphi) = \frac{1}{\cos \varphi}. $$

This means that regions at higher latitudes are stretched horizontally, even though meridians converge on the sphere.

Area Distortion

Since both horizontal and vertical scales grow with latitude, the total area distortion factor is

$$ A(\varphi) = \frac{1}{\cos^2 \varphi}. $$

At $60^\circ$ latitude, areas are already enlarged by a factor of four compared to the equator. Near the poles, areas are exaggerated without bound.

This effect famously leads to misinterpretations of relative country sizes — for example, Greenland appears comparable in size to Africa on a Mercator map, despite being more than ten times smaller in reality.

How to Read This Map Correctly

  • High-latitude regions appear larger than they actually are due to latitude-dependent scaling.
  • Color intensity represents population density per unit area — not total population.
  • Visual comparisons of country size should always be interpreted with projection effects in mind.
Schematic Mercator projection
Schematic illustration of the Mercator projection: a cylindrical projection preserving angles while strongly distorting scale toward the poles.

← Back to overview