Building a Strategy-Game Map of Canada from Open Data

Andrej Karpathy recently published usaciv, the United States drawn like a turn-based strategy map: painted hex terrain, cities with yield banners, resources on the tiles, lenses and advisors, all from public data. He released it under the MIT licence, and I wanted the same map for Canada.
The result is Canada Hex, live at canadahex.ca. It covers the 10 provinces and 3 territories, 152 cities, 30 lenses and 39 data sources. The renderer, the app shell and the shape of the pipeline are forked from usaciv. The code is open at github.com/rezmoss/canadahex.ca.
Like usaciv, it was built with an AI coding tool. Claude Code, running Claude Opus 5.5, wrote the code. My part was everything around it: finding Canadian sources a script can reach, deciding what each number should mean, questioning what Claude produced and checking results against Statistics Canada’s own figures. A second model, OpenAI’s Codex, reviewed each step independently.
It’s an atlas in strategy-game clothes, not a game. “Food” is the number of residents who work in farming, forestry and fishing, and Gold is GDP.

What a city is
A city here is a census metropolitan area or census agglomeration: 41 CMAs and 111 CAs, which are commuting areas rather than municipalities. The Toronto CMA is 6.2 million people over 5,903 km². The census lenses use the 293 census divisions, spread over 25 km hexes in an equal-area projection.
Apart from Gold, the yields count employed residents by industry, where they live. So Calgary’s “Oil town” badge means many Calgary residents work in oil and gas (8.2 times the national share), not that the wells are in the city. The same rule makes Sudbury a Mining town and Windsor a Motor city.
Statistics Canada publishes GDP for the 41 CMAs only. For the 111 CAs the pipeline estimates it from each province’s GDP outside its CMAs, divided by workers. It’s crude, so those figures carry a ≈ everywhere they appear.
Getting the data
Statistics Canada’s Census Profile and boundary files sit behind a browser check that a script can’t pass, and its data service refused Python’s default user agent. The census data tables (98-10-xxxx) download as zipped CSVs without trouble, and boundaries come from its ArcGIS map service, one province per request.
NRCan’s 2020 land cover is a 2.1 GB raster. Because it’s a cloud-optimised GeoTIFF, the pipeline reads only one low-resolution overview with HTTP range requests: 2.54 MB instead of the whole file. Over a quarter of Canada’s land hexes came out as tundra, which the US map never needed.
The worst bug was quiet. The census reader treated any member starting with “Total” as a grand total, and one table also has a category called “Total visible minority population”. Canada came out with 13,785 serving military members instead of 99,025. Only Total - counts now, and a test rebuilds the trap.

The pipeline is plain Python with no dependencies: sources download and tidy the raw files, builders put them on the hex grid, and a validator checks the outputs before the static site is built.
More layers
After the first version I added these, one at a time, each reviewed before the next:
- The 2025 federal election: official seats Liberal 169, Conservative 144, Bloc 22, NDP 7, Green 1, with each riding’s votes spread over the hexes it covers, plus margin and turnout lenses.
- Time sliders: population change since 2016, year by year to 2025, and wildfire over windows from 2025 alone back to 1972–2025.
- Migration routes: the 40 largest net flows between cities.
- A French interface.
- Pipelines and power lines from CanVec, labelled as historical mapping (1945–2002).
- Indigenous lands from the Canada Lands Survey System, with a note that this is not a map of territories, rights or title.
- Exports by city: Calgary led in 2025 with $126 billion of goods exported by businesses there.
- Crime severity for the CMAs with a published 2025 index: Canada 75, Chilliwack highest at 134, Barrie lowest at 47.
- Broadband: 50/10 Mbps available to 97.9% of homes by my count, not an official figure.

Making the map move
Then I wanted the map to feel alive. The rule: public data decides where things appear, how often and in which season. How they move is a drawing choice.
- Wildlife. 43 species appear where people recorded them on GBIF between 2015 and 2025, about 6.9 million observations, and in the months they’re seen. Click one for its Species at Risk Act status, a Wikipedia excerpt and a photo.
- Street life. Zoomed into a city, the mix of houses and towers follows census dwelling types and the traffic follows how people commute. Cranes stand for housing starts. Police scenes play more often where vehicle theft, break-ins and robbery are more common per person. The scenes are made up, and the tooltip says so.
- Planes, ships and boats. Planes take off more often at airports with more passengers, ships favour busier ports, and fishing boats follow each province’s catch.
- Recent activity. Snapshots taken when the data is built: fires at the satellite hotspots of the previous 24 hours, northern lights where NOAA forecasts them after dark, and the previous 30 days of earthquakes.
- More places. All 7,841 wind turbines at their real positions, 63 islands with facts, highways on their real courses, and each city’s best-known landmark standing on its tile, like the CN Tower in Toronto.

The animals, vehicles, ships and landmarks are painted sprites I generated with an image model and cut out with a short script.

What the reviews caught
Codex reviewed every step, and several of its findings had passed my checks and the validator:
- The first commute lens grouped workers by where they work, not where they live.
- Disaster polygons drawn in the wrong place added floods to the wrong provinces.
- Weighted clearance rates were steering how chase scenes ended, though they don’t measure that.
- 30 blasts were drawn as earthquakes.
- 18 landmark pictures showed the wrong building, like a Peterborough Lift Lock drawn as a ramp.
None of these crashed anything. The years also don’t line up: the census is 2021, city GDP 2022, growth runs to 2025, and each figure says its year.
Open source, and open to ideas
Canada Hex’s code is MIT-licensed, and the data keeps its sources’ licences, listed in the Almanac. I’ll keep maintaining it and adding to it. The 2026 Census tables are next once Statistics Canada publishes them.
If something is wrong, a landmark isn’t your city’s real symbol, or an island is missing, open an issue. If you want to add a layer, like ferry routes, provincial parks, ski hills or lighthouses, send a pull request. The one rule is the map’s own: every number needs a public source the Almanac can cite.
