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(),
)
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
)
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.