Uber's H3 Spatial Index
Uber indexes the world with hexagons rather than squares, because uniform neighbour distance makes supply, demand and pricing computations correct as well as fast.
The problem
Ride-hailing needs constant answers to spatial questions at very high frequency: how much supply and demand is in this area, what is the price here, which drivers are near this rider, how do conditions differ between adjacent areas. Doing this with raw coordinates means geometric computation per query, which does not survive the volume.
The standard answer is to discretise the world into cells and aggregate per cell. The interesting part is which shape.
Why hexagons
Uber open-sourced H3 in 2018: a hierarchical hexagonal grid covering the globe at multiple resolutions.
Squares have a defect that matters here. A square has eight neighbours at two different distances — four edge-adjacent, four corner-adjacent and further away. So "the neighbouring cells" is an ambiguous set, and any calculation that smooths or compares across neighbours is distorted by the geometry.
A hexagon has six neighbours, all equidistant, all edge-adjacent. Gradients, flood fills, smoothing and nearest-neighbour expansion all behave uniformly. For surge pricing — where the price in one area must relate sensibly to its neighbours, and a rider should not see a price cliff by crossing a street — that uniformity is a correctness property, not an aesthetic one.
The trade-off: hexagons do not subdivide perfectly into smaller hexagons, so H3's hierarchy is approximate, and the sphere cannot be tiled with hexagons alone (twelve pentagons are unavoidable, placed over ocean).
The architectural lessons
1. Choosing the right discretisation turns a geometry problem into a lookup. Every location becomes a cell ID, which is an integer — so it can be a partition key, a cache key, a map key, a join key. Aggregation becomes counting by ID. This is the same move as choosing a good shard key, applied to space.
2. Hierarchy gives you zoom for free. Coarse cells for city-level dashboards, fine cells for dispatch, with a defined parent/child relationship so aggregates roll up.
3. The shape of your index constrains the correctness of what you compute on it. Most teams pick a spatial scheme for performance and inherit its distortions silently.
Google's S2 library solves the same problem differently — square cells ordered along a Hilbert curve, which gives excellent locality for range queries. Neither is universally better: S2 favours range scans and containment; H3 favours neighbour arithmetic.