Uber H3: Hexagonal Spatial Indexing
also called H3, Hexagonal Hierarchical Index
Uber built and open-sourced a hexagonal grid index because uniform neighbour distance matters when you are analysing supply and demand across space.
The problem
Uber's marketplace problems are spatial: where is demand exceeding supply, what area should a surge multiplier apply to, which drivers should be considered for a request, how do we aggregate metrics by area.
The obvious approach is a rectangular grid, or a quadtree-based scheme dividing space into squares. That works for indexing and is subtly wrong for analysis, because a square has two kinds of neighbour: four sharing an edge and four sharing only a corner, at different distances. Any smoothing, clustering or flow calculation over a square grid inherits that distortion.
What they did
H3, open-sourced in 2018, indexes the globe with hexagons. A hexagon has six neighbours, all equidistant from its centre. Spatial smoothing, gradient calculations and nearest-neighbour analysis over a hexagonal grid behave uniformly in every direction.
The index is hierarchical, with multiple resolutions, so an area can be described coarsely or finely and cells can be aggregated upward. Cells have compact integer identifiers, which makes them usable as database keys, cache keys, partition keys and map-reduce keys.
The trade-off
Hexagons do not tile hierarchically with perfect containment — a parent hexagon cannot be exactly subdivided into child hexagons, so H3 accepts approximate containment between resolutions. For most analytical uses this is immaterial; for anything requiring exact partitioning of area it matters and must be understood.
Squares, by contrast, subdivide perfectly, which is why square-based schemes remain the right choice for use cases dominated by exact hierarchical containment.
The transferable lesson
The choice of spatial index is a modelling decision that propagates into every downstream calculation, not a library choice. The same reasoning applies more generally: whenever you discretise a continuous space — geography, time, price bands, age ranges — the shape of the buckets constrains what analysis is meaningful over them.
And the practical point: cell identifiers make excellent partition keys. Sharding a geospatial workload by cell gives locality, so queries about an area touch few partitions — which is the property that makes real-time spatial systems affordable.