All thirty days

Day 22: Projections

Web Mercator, the projection of almost every web map, draws Canada's land 5.2 times its size. The three territories, home to 0.3% of Canadians, fill 66.7% of the map.

mercator.json
Loading 5,161 municipalities
Projection
Drawn at
Click a municipality.

Almost every web map is drawn on Web Mercator, and Mercator is hardest on the north. To keep shapes true in the small, Mercator stretches the map north and south as much as it stretches it east and west, and the stretch grows toward the pole: at 45°N it draws the ground at twice its area, at 60°N four times, and at Canada's northern tip, 83°N, 70 times. Every other map this month opened on the globe. This one opens flat, the way most maps of Canada are seen.

Added up municipality by municipality, Mercator draws Canada's 8,788,703 km² of land as 45.9 million km², 5.2 times its size. Yukon, the Northwest Territories and Nunavut are 39.1% of the land and 66.7% of the map, with 0.3% of the people. Nunavut is 2.1 times the size of Ontario, and on Mercator it looks 9.3 times. The unorganized part of the Qikiqtaaluk Region, most of Baffin Island and the islands north of it, where the 2021 Census counted nobody, fills 32.7% of the map on its own. The most stretched municipality is Grise Fiord, 144 people, drawn 18.3 times its size; the least is Pelee, on Lake Erie, at 1.8.

People live where the map stretches least. 34.1% of Canadians live in municipalities Mercator draws less than twice their size, almost all in southern Ontario and Nova Scotia, on 1.2% of the land; Toronto is drawn at 1.9 times, Calgary 2.5, Iqaluit 5.1. Half of Canadians live at 2.04 times or less. The other way round, the 34 most stretched municipalities, which together fill half of Canada as Mercator draws it, are home to 23,835 people, 0.06% of the country.

Each municipality takes one shade, the average stretch over its area, so the vast unorganized areas of the north are one colour across many degrees of latitude; the dashed parallels mark exactly where the stretch passes 2, 3, 5 and 10 times. Switch to the globe, with the camera where it was, and the country falls back into proportion: the islands of the north shrink and the south grows to meet them. The globe is not an equal-area map either, since it shows a sphere in perspective and foreshortens the ground toward the edges of the view, but nothing on it grows with latitude. Click a municipality for its numbers.

How it's made

One basemap and one layer. This is the whole map, minus the legend.

import { createMap } from '@unmap/sdk'

// Day 9's municipalities, each with f: how many times larger Web Mercator draws it than it is.
// f is its area on Mercator over its area on the sphere, both by the shoelace formula:
//   equal area  x = λ, y = sin φ
//   Mercator    x = λ, y = ln tan(π/4 + φ/2)
// which is the mean of 1 / cos²φ over the municipality.
const csds = await fetch('/mercator.geojson').then((r) => r.json())

// createMap draws the globe unless told otherwise. Today it is told otherwise.
const map = createMap({ key: 'um_pk_live_...', container: '#map', style: 'muted', projection: 'mercator' })

map.on('load', () => {
  map.addSource('csds', { type: 'geojson', data: csds })
  const labels = map.getStyle().layers.find((l) => l.type === 'symbol').id
  map.addLayer({
    id: 'csds',
    type: 'fill',
    source: 'csds',
    paint: {
      // Brighter where Mercator stretches more: under 2×, 2× to 3×, 3× to 5×, 5× to 10×, 10× and more.
      'fill-color': ['step', ['get', 'f'], '#33203A', 2, '#56294A', 3, '#8A3266', 5, '#C43A80', 10, '#FF3E9A'],
      'fill-opacity': 0.9,
    },
  }, labels) // under the place names
})

// The same map on the globe, with the camera where it is.
document.querySelector('#globe').onclick = () => map.setProjection({ type: 'globe' })

The municipalities are Day 9's: Statistics Canada's 2021 census subdivisions, 5,161 of them, on the cartographic boundary file simplified to about 400 m, with land area and population summed from the census blocks, 36,991,981 people in all. For each, the stretch is its area on Web Mercator divided by its area on the Earth, both measured from the same polygons with the shoelace formula, on Lambert's cylindrical equal-area projection for the true area and on Mercator for the drawn one. Web Mercator projects a sphere, so the true area is taken on the same sphere. The ratio is the average of 1/cos² of the latitude over the municipality, so it depends neither on the size of the sphere nor on how far the boundary is simplified. 209 municipalities whose polygons are too small to measure take the stretch at the mean latitude of their vertices. A municipality's drawn area is its census land area times its stretch. The numbers count land only: Mercator stretches Hudson Bay and the Arctic channels as much as the land around them, and the census subdivisions leave the water out. The territories include a few Nunavut islands south of 60°N, in Hudson Bay and James Bay. The script is scripts/build-challenge-mercator.mjs in the unmap repository.

Data

  • Municipalities, land area and population: Statistics Canada, 2021 Census, census subdivision cartographic boundary file and Geographic Attribute File (92-151-X), as on Day 9. Used under the Statistics Canada Open Licence.
  • Basemap: unmap, © OpenStreetMap contributors.

Share this map

Post it, or make your own and tag it #30DayMapChallenge.