Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 13.2 — Projections and geoPath
Data Visualization · Example 1 of 2

The world in three projections, with Greenland and Congo measured

Antarctica is cut off in the Mercator picture by the square the projection clips to. The Equal Earth figure matches the true ratio.

A projection turns [longitude, latitude] on a ball into [x, y] on a flat screen, and every way of doing it bends something: shape, area, distance or direction. geoPath draws projected shapes, and fitSize makes a map fill its box.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 4 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write visible(projection, point) for an orthographic globe. It returns the [x, y] pixel for visible points and null for hidden ones. Test it with [0, 0] and [150, 0].

02

Write fitTo(projection, features, size) that fits the projection to the features, and returns null instead of a broken projection when features is empty.

Explain it without notes

01

What does a projection do, and why can no flat map be accurate everywhere?

02

Why does Greenland look so large in Mercator? What would you use to compare areas instead?

03

What does fitSize set, and what goes wrong if you give it one point?

04

Why can drawing stations on an orthographic globe with projection(point) produce wrong dots?

The world in three projections, with Greenland and Congo measured

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

True area: Greenland is 0.94 times the Democratic Republic of the Congo
Mercator      | Greenland looks 15.39 times the Congo
Equal Earth   | Greenland looks 0.94 times the Congo
Orthographic  | Greenland looks 0.22 times the Congo