Writing a map engine from scratch

中文

Map Bench

Each workbench here takes one part of how maps are made and writes it from scratch, with no map library underneath. Every one is a live map you can drag, with the method laid out beside it.

  1. Part 1

    Tilework

    Tokyo drawn straight from a PMTiles file: byte-range reads, vector tiles decoded by hand, polygons filled with the stencil buffer.

    Open
  2. Part 2

    Graticule

    Twenty projections over one sphere, with Tissot circles, a distortion map and countries you can drag to another latitude.

    Open
  3. Part 3

    Relief

    Mount Fuji from GSI elevation tiles: hill shading, contours and a terrain block, with a sun you can move and a profile you can draw.

    Open
  4. Part 4

    Lettering

    The names on a map of central Kyoto: distance-field letters, street names that follow the street, and no label covering another.

    Open

No map library

Tile decoding, projection, triangulation, label placement and simplification are all written for the page they appear on.

Real, open data

OpenStreetMap, Natural Earth, GSI elevation tiles and aerial photos, the 2020 census and PLATEAU, each credited on its map.

The method beside the map

Each page explains its algorithm step by step and reads back the numbers it measures, in English or Chinese.