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
- Up to 100 points per request. Over it you get
too_many_points. Send long trips in pieces that overlap by a few points. - Trial: 60 requests a minute together with directions, 1,000 a day.
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"
}
- A point that could not be matched to a road is left out.
original_indextells you which of your points each one is. interpolate: truealso returns the points along the road between them, withoriginal_index: null.distance_mis measured along the matched roads, from the first matched point to the last.mode(carby default, orokada,keke,bicycle,walk) decides which roads count.
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.