Open to AI Engineer roles — available immediately, no notice period to serve
Back to projects

mapcraft

Open source · published

A choropleth library that refuses to draw a map when the result would mislead the reader.

Mapping raw counts across regions of different population draws a map of population wearing the costume of whatever was counted — the most common error in thematic mapping, and an invisible one, because the map still renders cleanly and looks authoritative. Measured on US Census data, total births by state correlates 0.9921 with state population; normalised per capita it correlates 0.0616, and five of the top six states change. mapcraft makes the decisions a choropleth actually requires — normalisation, classification, equal-area projection, colourblind-safe palettes — refuses to render when the result would mislead, and prints every decision it made on the map itself. Zero runtime dependencies: the Albers and Mollweide projection maths, Fisher-Jenks natural-breaks classification, TopoJSON decoding and SVG emission are all implemented directly. Four bundled geography packs pin boundary and population vintages together, because pairing 2024 population with 2021 boundaries silently divides some rates by the wrong denominator.

0.9921 correlationRaw-count map vs population
0.0616 correlationNormalised map vs population
3,141 US counties · 240 countries · 36 India statesRegions
47, numeric assertions onlyTests
PythonZero dependenciesSVGTopoJSONCartographyCLIAgent skill
View source