Blog ·

How ride-matching apps work: drivers, offers, trip states and maps

A ride-matching app runs in a loop. Driver phones send their GPS position to a server every few seconds. When you ask for a ride, the server finds a free driver near your pickup, sends them an offer, and waits for a yes. A routing engine running on map data, such as OpenStreetMap, works out the route and the travel time.

Animation: the rider picks one motorcycle, the offer goes to that driver with a time limit, the driver accepts, arrives and completes the ride. The trip moves through Requested, Matched, Arrived, In progress and Completed.
One Quick Ride request, from the rider's choice to a finished trip.

You tap "Request ride". Here's what happens next

You set a pickup and a destination, and you tap the button. In most ride apps, the next few steps look like this:

  1. The server creates a new trip.
  2. It looks for drivers who are online, free and close to your pickup.
  3. A driver's phone shows an offer. They have a short time to answer.
  4. They accept. The trip is matched, and both phones now show each other on the map.
  5. The driver rides to you, starts the trip, and ends it at your destination.

Simple on paper. The hard part is that the world keeps moving while this happens. Drivers move, riders cancel, and phones lose signal. The system has to stay correct through all of it.

Knowing where drivers are

While a driver is online, their app sends its GPS position to the server every few seconds.

Treat each position as a close guess, not a perfect point. Smartphone GPS is typically accurate to within 4.9 metres under open sky, and worse near buildings, bridges and trees.

Many apps keep each driver's latest position in a fast index, so they can ask "who is within this radius of the pickup?" in an instant.

Two rules keep that data honest:

One driver at a time, or everyone at once?

There are two common ways to hand out a request. Each one trades rider waiting time against fairness to drivers.

A one-at-a-time search usually starts with a small circle around the pickup and makes it bigger if nobody is free. It remembers who already said no, so it doesn't ask them again. And every offer has a time limit, so a driver who doesn't answer can't hold you up forever.

Trip states: one label, a few allowed moves

Ride apps track each trip with one label that says where it is in its life. Only certain moves between labels are allowed. A trip can go from "matched" to "arrived", for example, but a finished trip can't start again.

Clear labels make the tricky moments simple. Say a driver taps accept at the exact moment the offer runs out. Only one of those two changes can win, and the other is refused.

Routes and arrival times come from a routing engine

Roads bend and some streets go one way, so a straight line on the map gets the distance wrong. A routing engine reads the roads as a network and finds the fastest path.

OSRM, the Open Source Routing Machine, is a C++ routing engine that can import OpenStreetMap data. Its API has a few services that ride apps lean on:

Where the map comes from

Ride apps usually show a map made of small square pictures, called tiles, drawn from map data such as OpenStreetMap.

OpenStreetMap is a free, editable map of the whole world, built by volunteers. You can use the data as long as you credit OpenStreetMap and its contributors. That's why you see "© OpenStreetMap contributors" in the corner of so many maps.

The data and the picture are separate. A map server turns the data into tiles. On the standard layout, each tile is 256 by 256 pixels, one tile shows the whole world at zoom 0, and each zoom level has four times as many tiles as the last. Raster tiles are ready-made images. Vector tiles carry the data, and the phone draws it.

How it looks in Quick Ride

Quick Ride connects passengers with independent motorcycle drivers in Albania. It works one driver at a time, but you make the choice.

Every trip moves through these stages: