SSSofikul SkBackend Engineer
← All writing

Thinking in Hexagons: Understanding Uber's H3 Geospatial Indexing System

How Uber turns raw geographic coordinates into scalable spatial computation using hierarchical hexagonal indexing.

/8 min readSystemsArchitectureDistributed Systems
Originally published on Medium

At small scale, geography feels simple.

A latitude. A longitude. A point on a map.

But at Uber's scale, geography becomes a systems problem.

Millions of drivers, riders, deliveries, and routes are constantly moving across cities in real time. Every second, systems need to answer questions like:

  • Which drivers are nearby?
  • Which region is getting overloaded?
  • Where is demand increasing?
  • How do we group movement efficiently across an entire city?

The challenge is no longer storing coordinates. The challenge is making geography computationally predictable.

Traditional latitude and longitude coordinates are excellent for representation, but they become difficult to work with when systems need to perform large-scale spatial operations repeatedly and efficiently.

This is where Uber's H3 geospatial indexing system becomes fascinating.

Instead of treating the Earth as a collection of disconnected coordinates, H3 transforms geography into a structured, hierarchical grid of hexagons — making spatial computation significantly easier to reason about at scale.

What makes H3 interesting is not just the geometry. It is the engineering mindset behind it. It represents a shift from simply representing locations to designing systems that can understand, organize, and query the planet efficiently.

The problem with raw coordinates

At first glance, latitude and longitude seem sufficient. Every location on Earth can already be represented using coordinates, so why would systems need anything more?

The problem appears when geography becomes operational.

Modern applications are not simply storing locations. They are constantly asking spatial questions in real time:

  • Which drivers are within 2 kilometers?
  • Which delivery zones are overloaded?
  • Which regions are seeing unusual activity?
  • Which users are moving toward the same area?

These queries sound simple, but performing them efficiently at massive scale is surprisingly difficult.

Raw coordinates are excellent for precision, but they are not naturally optimized for grouping, indexing, or spatial traversal.

Two locations that look numerically close may behave very differently geographically. Distance calculations become computationally expensive when millions of points must be evaluated continuously. Even something as simple as "find nearby drivers" can quickly turn into a large-scale nearest-neighbor search problem.

To make these systems efficient, geography needs structure.

Instead of treating the Earth as billions of independent coordinate pairs, systems need a way to partition space into predictable regions that are easier to query, organize, and reason about.

This is where spatial indexing begins to matter. Rather than searching the entire planet coordinate by coordinate, systems can operate on grouped geographic cells — dramatically reducing complexity and improving scalability.

RAW COORDINATESO(n) comparisonsINDEXED CELLSO(cells) lookups
Left: every query compares against every point. Right: the same points bucketed into cells, so a query touches cells instead of coordinates.

Why grids matter

One way to simplify geographic computation is to stop thinking about the planet as isolated coordinate points. Instead, systems can divide space into smaller regions — or cells — and operate on those regions collectively.

This changes the problem entirely. Rather than continuously comparing millions of raw coordinates, systems can work with grouped spatial areas that are easier to index, query, and analyze.

For example:

  • nearby searches become cell lookups
  • demand analysis becomes region aggregation
  • movement patterns become transitions between cells
  • spatial queries become significantly more predictable

In many ways, spatial indexing works similarly to database indexing. The goal is not just storing information. The goal is reducing search complexity.

By partitioning geography into structured regions, systems gain a more organized representation of the physical world — one that is far easier to scale computationally.

But this introduces another important question: what shape should these regions be?

At first, squares may seem like the obvious answer. They are easy to visualize, simple to compute, and naturally align with traditional grid systems. However, once systems begin operating at massive scale, square grids start revealing limitations — especially around distance consistency and neighboring relationships.

This is where hexagons become surprisingly powerful.

Why hexagons?

Once geography is divided into cells, the next question becomes surprisingly important: what shape should those cells be?

At first, squares seem like the natural choice. They are simple, familiar, and easy to organize into grids. Many traditional spatial systems have used square-based partitioning for exactly that reason.

But squares introduce subtle problems.

SQUARE GRID4 share an edge4 touch a corner onlyHEXAGONAL GRID6 neighbours, all sharing an edge
A square cell has two classes of neighbour — four sharing an edge, four touching only at a corner. A hexagon has six neighbours and every one shares a full edge.

The biggest issue is inconsistency between neighbors. In a square grid, some neighboring cells share edges while others only touch at corners. This creates uneven movement relationships and introduces directional bias into spatial calculations. Moving diagonally across square cells behaves differently from moving horizontally or vertically.

At small scale, this may not seem significant. But at the scale of systems like Uber, even small inconsistencies become amplified.

Hexagons solve many of these problems elegantly.

Unlike squares, every neighboring hexagonal cell shares a full edge. Distances between neighboring cells become more consistent, and movement across the grid feels more uniform in every direction. This creates a much more natural representation of spatial relationships.

Hexagons also approximate circular coverage better than squares. That matters because many real-world spatial operations — nearby searches, delivery radiuses, movement zones — behave more like circles than rectangles.

The result is a grid system that is both computationally efficient and geographically intuitive.

What makes this especially fascinating is that the decision is not purely geometric. It is architectural. The shape of the grid directly influences how systems reason about space at scale.

Enter H3

To solve large-scale spatial problems more efficiently, Uber developed H3 — an open-source geospatial indexing system built around hierarchical hexagonal grids.

At its core, H3 partitions the Earth into hexagonal cells of different sizes. Instead of working directly with raw coordinates, systems can convert locations into indexed hexagonal regions that are easier to query, organize, and analyze.

But what makes H3 especially powerful is not just the use of hexagons. It is the hierarchy.

The grid is designed across multiple resolutions. Large hexagons can be subdivided into smaller and smaller cells, allowing systems to represent geography at different levels of precision depending on the use case.

A city-level analysis may use larger cells. A nearby-driver query may use much smaller ones.

RES 4cityRES 57 childrenRES 649 children
Each resolution subdivides the one above it. H3 children are rotated about 19 degrees inside the parent, so the nesting is approximate — a cell has one parent, but its children spill slightly across the boundary.

This hierarchical structure gives systems flexibility without losing consistency. Every cell belongs to a larger parent region while also containing smaller child regions beneath it. That relationship makes spatial computation significantly easier to scale.

Instead of treating the planet as an unstructured collection of coordinates, H3 creates an indexed geographic hierarchy — one that systems can navigate efficiently across different levels of granularity.

In many ways, H3 behaves less like a map and more like an organized spatial database.

Hierarchy and resolution

One of the most important ideas inside H3 is resolution.

The Earth is not divided into a single fixed grid. Instead, H3 creates multiple layers of hexagonal cells at different levels of granularity.

At lower resolutions, cells are large and cover broader geographic regions. At higher resolutions, those same regions are subdivided into much smaller hexagons, allowing systems to represent space with far greater precision.

This hierarchical design makes H3 extremely flexible. The same indexing system can support both high-level regional analysis and highly localized spatial operations.

For example:

  • a logistics platform may analyze city-wide demand using larger cells
  • ride matching may rely on smaller cells for nearby-driver discovery
  • delivery optimization may operate across multiple resolutions simultaneously

What makes this especially powerful is the parent-child relationship between cells. Every smaller hexagon belongs to a larger parent region. This creates a navigable geographic hierarchy that systems can traverse efficiently.

Instead of treating spatial data as disconnected points, H3 organizes geography into structured layers of abstraction.

That structure becomes incredibly valuable at scale. Aggregation becomes easier. Queries become faster. Spatial relationships become more predictable. And systems gain the ability to reason about geography at different levels without constantly recalculating raw coordinate relationships.

In many ways, this mirrors how scalable software systems are designed in general. Complexity becomes manageable when it is organized hierarchically.

Real-world applications

The real strength of H3 appears when spatial computation becomes operational.

At Uber's scale, systems are continuously processing geographic activity across entire cities in real time. Drivers move. Riders request trips. Deliveries shift between regions. Demand fluctuates block by block.

Without structured spatial indexing, these operations would become increasingly difficult to manage efficiently. H3 helps simplify many of these problems.

Nearby driver discovery

One of the most obvious use cases is ride matching.

Instead of searching across massive collections of raw coordinates, systems can first identify nearby hexagonal cells and narrow the search space significantly. This makes proximity queries faster and more computationally predictable.

k-RING SEARCHridercandidate drivernever loaded1 + 6 + 12 = 19 cells
A nearby-driver query resolves the rider to one cell, then walks outward ring by ring. k=2 inspects 19 cells instead of every driver in the city.

Demand heatmaps

By aggregating activity inside hexagonal regions, systems can visualize demand patterns more effectively. Areas with unusually high ride requests or delivery traffic become easier to detect and analyze.

Because hexagons provide more consistent spatial coverage, these heatmaps often behave more naturally than square-based visualizations.

Surge pricing and dynamic regions

Spatial indexing also helps define operational zones dynamically. Instead of relying on rigid geographic boundaries, systems can respond to real-time activity patterns across groups of neighboring cells.

This becomes especially useful when demand changes rapidly across different parts of a city.

Logistics and delivery optimization

For delivery systems, geography is constantly changing. Orders, drivers, traffic conditions, and routes all interact simultaneously.

H3 provides a structured way to partition and reason about these moving spatial relationships. The result is not just better mapping. It is better decision-making.

What makes H3 fascinating is that it transforms geography from a visual problem into a computational system — one that scalable infrastructure can operate on efficiently in real time.

Closing thoughts

What makes H3 interesting is not just the geometry. It is the engineering philosophy behind it.

At first glance, H3 appears to be a mapping solution — a clever way to divide the Earth into hexagons. But underneath that idea is something much more important: the transformation of geographic complexity into structured computation.

That shift changes everything.

Instead of treating the planet as billions of disconnected coordinate pairs, H3 creates a system that can reason about geography hierarchically, predictably, and at scale.

And that idea extends far beyond maps. Many scalable systems succeed because they reduce chaotic real-world problems into structures that computation can manage efficiently.

Queues organize asynchronous work. Indexes organize search. Caches organize access patterns. H3 organizes space.

What makes systems engineering fascinating is that these abstractions often feel simple once they exist — even though the thinking behind them is deeply sophisticated.

The elegance of H3 is not that it makes geography more complicated. It is that it makes geography computationally understandable.

And at scale, that distinction matters.


Thanks for reading. I've recently become fascinated by how scalable systems simplify real-world complexity through abstraction, and H3 is one of the most elegant examples of that idea.