Cards/Distributed SystemsSystem Design · Day 10Aug 10, 2026

Turning The Earth Into Words

Turning The Earth Into Words — system design card, day 10, distributed systems

"Find everything within 3km" sounds simple. Databases hate it.

Latitude and longitude are two independent numbers. There's no single ordering of points on a sphere, so a normal index can't help. You end up scanning.

The trick: stop storing coordinates, start storing cells.

Cut the world into a grid. Cut each square into smaller squares. Keep going. Every point on Earth now has a short string — and nearby places share a prefix.

PrefixResolves to
9q8yyA neighbourhood
9q8yykA few streets
9q8yyk8A block

"Nearby" just became "starts with the same letters." A B-tree does that instantly.

The catch: cells have edges. A driver 50 metres away across a boundary looks far apart in text. So you always search the neighbours too.

Hard problems are rarely solved head-on. They're translated into a shape something already knows how to search.