luso.earth: Brazil and Portugal, hex by hex
Cases & Analysis

luso.earth: Brazil and Portugal, hex by hex

Karpathy drew the US as a strategy map from public data and left the seat open. I took it with two countries and what crosses the Atlantic between them.

TL;DR
  • ›Brazil in 15,849 hexes and Portugal in 4,317, with relief, rivers, cities, power plants and harvests where they really are
  • ›In the middle, the Bridge: ships, planes and light on the cable carrying what each country sends the other, with number, year and source
  • ›140 sources from 77 public bodies, every file with URL, date and sha256, and missing data left empty
  • ›MIT code and open data at luso.earth, ready to fork
Listen to the article
0:00/0:00
1x

Andrej Karpathy closed the post about his map with "someone else will have to take over :D". I did.

I really like how this guy thinks. He drew the United States as a Civilization map, one of my favorite games, using only public data, and called it usaciv. Right after, people started doing the same with their own countries, and I had to try my version.

Except I wanted two countries together, and the whole exchange between them.

The luso.earth trailer, recorded from the live map

The spreadsheet that becomes a board

In a hex strategy game, you read the land before deciding anything. Where the river runs, where the mountains rise, which city grows, where the iron is. IBGE, Brazil's statistics office, publishes exactly that, in tables, and nobody opens a table for fun. Drawn as a board, the same data reads at a glance.

Brazil went in as 15,849 hexes of 25 km, and Portugal as 4,317 of 5 km. Each country has its own grid, and both show at the same scale on screen. Relief, forest, rivers, cities, power plants, mines, ports and harvests sit where they really are.

Even the trees come from the data. One canopy rises for every 14% of forest in a hex, one house for every 7% of urban area, and mountains only appear where the relief is mountain. The art is our own, low-poly, drawn from scratch for luso.earth.

All of Brazil on the map, with ships and planes leaving the coast for PortugalAll of Brazil on the map, with ships and planes leaving the coast for Portugal

On top of the land go the lenses, which paint one indicator per municipality: 37 in Brazil and 25 in Portugal, from income and sanitation to votes. 277 cities in Brazil and 89 in Portugal get a profile, with what each one yields, makes and employs.

What crosses the Atlantic

The part that got me most is the middle. The Bridge button opens the same panel in both countries, with 33 flows of what leaves one and arrives in the other, across six tabs (People, Food and grain, Travel, Screen and sound, Money, Ties). A few of them:

  • 368,391 Brazilians live in Portugal (INE, 2023), and 148,633 Portuguese hold active residence in Brazil (Federal Police, 2026).
  • Portugal sold 351 million euros of olive oil to Brazil in 2025, and Brazil sent 201 million in soy the other way (Eurostat).
  • 3.03 million passengers flew between the two countries that year, half in each direction (ANAC).
  • Films with Brazil among their countries of origin drew 517,000 viewers to Portuguese cinemas in 2025. Films with Portugal among their origins drew 142 people to cinemas in Brazil (ICA and ANCINE).
  • Brazilian direct investment in Portugal adds up to 4.4 billion euros, against 2.8 billion of Portuguese investment in Brazil, and it has been the larger of the two since 2017 (Banco de Portugal).

In the Crossings layer, those flows move. Ships carry cargo, planes carry the passengers of each route, and films and remittances run as light along EllaLink, the submarine cable between Fortaleza and Sines. Ships, planes and light are drawings. What each one carries is a flow from the Bridge, with its number, year and source, and clicking it opens that flow.

Ships only sail on water. In the first version, a ship leaving Santos for Portugal cut across the Brazilian northeast by land. Now the route is found on sea hexes only, keeping off the coast and rounding the cape, and a river port drops the ship at the nearest bar.

Portugal with the Bridge open and ships arriving along the coastPortugal with the Bridge open and ships arriving along the coast

No source, no number

Every number on screen comes from a file downloaded from the body that publishes it, with URL, date and sha256 recorded, and the app shows the list. That's 140 sources from 77 public bodies: IBGE, INPE and ANAC on one side, INE (Portugal's IBGE) and the Portuguese Environment Agency on the other, Eurostat and Copernicus for the European Union.

A source that isn't a public body goes in marked and listed apart. There are seven, like the NOAA relief model and the sister cities from Wikidata. Missing data stays empty. A municipality without a number in a lens stays uncolored, with no invented zero and no neighbor average.

What I looked for and left out is written down too, with the reason. Brazil's port cargo portal answers with a bot challenge, and the emergency decree system only serves connections from inside Brazil. Faith changes unit from one country to the other: in Brazil it counts places of worship with a tax registration, in Portugal it counts people working in religious and associative organizations, because that's what each country publishes.

Central Portugal up close, with river, forest, farmland and town on every hexCentral Portugal up close, with river, forest, farmland and town on every hex

Open for anyone who wants their own country

The code is MIT, and the data keeps the license of each body. It's a static site, React and three.js reading JSON, with no backend, no login and no API key. The JSON ships with the repository, so the map runs as cloned. Each domain has a script that downloads its own sources and rebuilds the file. Portugal came in that way, with a new grid and one pipeline per domain, and another country comes in the same way.

It's live at luso.earth, with code and data at github.com/inhabitants/luso.earth. The same map runs here at Sapiens as the Terra Brasilis Lab, open without login.

The README says no support is promised. Forks are welcome.

Sapiens Sintéticos

Notes from the lab.

Essays, experiments and bench notes on synthetic media, intelligence design, and the new software paradigm. It arrives when there is something worth reading.

#karpathy·#open source·#dados abertos·#mapas·#brasil·#portugal

Related readings