Rana Maps developers

Beta

Roads: snap to roads

Today: live (Beta) since 11 November 2026.

What it does

Takes a noisy GPS trace and returns the points moved onto the roads the vehicle most likely drove, with the distance along them. Use it for fares by distance driven and for drawing a clean trip line.

In our test, a noisy Lagos trace of 127 points gave 13.53 km against a true route of 13.54 km.

Limits

Request

POST https://maps-api.ranamaps.com/v1/roads/snap

curl https://maps-api.ranamaps.com/v1/roads/snap \
  -H "X-Rana-Key: $RANA_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"points": [{"lat": 6.4541, "lng": 3.3947}, {"lat": 6.4549, "lng": 3.3952}], "mode": "car", "interpolate": true}'

Answer (example values)

{
  "points": [
    { "lat": 6.45412, "lng": 3.39468, "original_index": 0 },
    { "lat": 6.45488, "lng": 3.39515, "original_index": 1 }
  ],
  "distance_m": 13530,
  "geometry": "o~{zKq}xiE...",
  "attribution": "© Rana Maps © OpenStreetMap"
}

Coverage

All of Nigeria's mapped roads once the Nigeria release is deployed. A road that is missing from the map cannot be snapped to; our contributors add missing roads, mostly in Lagos first.