← Joan Alavedra

desipix

Tile cartograms in the browser, built from real geography plus real data. A region’s size comes from a weight variable — population by default — and its colour from whichever indicator you pick, so one map carries two variables at once. Identity comes from labels and the tooltip, never from the fill.

Three geographies (Espanya by comunitats, Catalunya by comarques, Europa by NUTS-2), each with eight indicators going back as far as 1990, and three views: the map, an indexed line chart of every region on one axis, and a ranking. Everything in Catalan; the state lives in the URL so any view is shareable.

The map itself has three forms — a tile cartogram, a Dorling circle map, and a non-contiguous scaled map of the real polygons.

The tile allocator is the whole trick. It rasterizes the geography into a square grid, flood-fills from outside to find and close enclosed holes, resizes each landmass to exactly its tile budget by working only its outer boundary, then grows every region outward from its geographic seed until it hits its exact tile count. Tile counts come from the data, not from area — so Barcelonès, which holds 29% of Catalonia’s population in 146 km², gets 29% of the tiles.

Getting there meant measuring rather than eyeballing. tools/verify.html reports allocation error, compactness and geographic drift for all three maps, and two design decisions came straight out of it: growth distance is unweighted (weighting by 1/sqrt(target) sizes regions correctly but yields non-convex cells — compactness 2.29× an equal-area disc against 1.34× unweighted), and the Lloyd relaxation uses a light anchor pull (a stronger one cost compactness without buying any fidelity back).

Regions do move on a cartogram, and that is not a defect: Barcelona’s metro comarques hold roughly 60% of Catalonia’s people on 5% of its land, in a coastal corner, so they can only grow inland.

Pure static site — vanilla JS, D3 from a CDN, no build step. Data from Eurostat and Idescat, rebuilt by scripts in tools/. Boundaries from click_that_hood (Spain), ICC (Catalan comarques) and Eurostat GISCO (NUTS-2). Try it above.