Article
Maps & Navigation App Stores Hexagonal Tiling Geospatial Indexing

How Uber finds a nearby driver without scanning every car in the city

Matching a rider takes seconds, but the maths behind it starts with dividing the whole planet into hexagons.

by Ian Lyall
The image shows the rear of a vehicle with a glowing Uber sign, indicating the car is likely in use for ride-sharing services. The setting appears to be indoors, possibly a garage or a parking area. — Credit: Photo by Erik Mclean on Unsplash c Photo by Erik Mclean on Unsplash

Uber operates in cities where tens of thousands of drivers can be active at once, each sending an updated location roughly every four seconds.

Calculating the distance from every rider to every one of those drivers, for every single ride request, would overwhelm Uber's servers within minutes.

Uber avoids that problem by narrowing the search before any distance calculation happens at all.

Dividing the map into hexagons

The company relies on a system called H3, which divides the Earth's surface into a grid of hexagonal cells, each smaller than one square kilometre.

Every driver and every rider falls inside one of these hexagons at any given moment, based on their current location.

When someone requests a ride, Uber only searches the rider's own hexagon and the six hexagons touching it.

That narrows the pool of drivers to check from thousands down to a few hundred, before any further calculation begins.

Why hexagons rather than squares

Uber chose hexagons over square grid cells because every hexagon has six neighbours, all of them the same distance from its centre.

A square grid does not share that property: cells diagonally adjacent to a square are further from its centre than cells directly above, below, or beside it.

That inconsistency makes squares a poorer approximation of "nearby" than hexagons, which treat every neighbouring cell equally.

Distance is not the same as time

Narrowing the search to nearby hexagons only solves part of the problem, because the closest driver in a straight line is not always the fastest one to arrive.

A driver a few hundred metres away by direct distance might be separated from the rider by a river, a motorway, or a one-way system that adds several minutes to the actual journey.

Uber's matching system has to weigh real road travel time against straight-line proximity, rather than assuming the nearest car by distance is automatically the best match.

Matching in batches, not one by one

Rather than processing each ride request the instant it arrives, Uber groups requests together and matches them in batches.

Batching allows the system to assign drivers across several riders at once, reducing the chance that two nearby riders are sent competing for the same car.

The result is a matching process that looks instantaneous to a rider tapping "request", but relies on geometry, road data, and careful sequencing to work at city scale.

by Ian Lyall
whatsnew. APPS · WEB TOOLS · SECURITY · AI

Know what’s new.

The useful side of the internet. Covered properly.

Set as preferred →

Related Stories