Beta
Distance matrix
Today: live (Beta) since 11 November 2026.
What it does
Gives the distance and time from each origin to each destination, for example from 10 drivers to 10 pickups. The same modes as directions, with the same gates and closed roads left out.
Limits
- Up to 100 cells per request (origins × destinations). 10 × 10 is fine; 20 × 10 is not. Over it you get
too_many_cells. - Usage counts one unit per cell. Trial: 1,000 cells a minute, 10,000 a day.
On our test machine a 10 × 10 matrix in Lagos took about a quarter of a second.
Request
POST https://maps-api.ranamaps.com/v1/directions/matrix
curl https://maps-api.ranamaps.com/v1/directions/matrix \
-H "X-Rana-Key: $RANA_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"origins": [{"lat": 6.4541, "lng": 3.3947}, {"lat": 6.4281, "lng": 3.4219}],
"destinations": [{"lat": 6.5965, "lng": 3.3421}],
"mode": "car"
}'
Answer (example values)
{
"rows": [
{ "cells": [{ "distance_m": 18412, "duration_s": 1710 }] },
{ "cells": [{ "distance_m": 21950, "duration_s": 2033 }] }
],
"attribution": "© Rana Maps © OpenStreetMap"
}
- A cell with no route has
"distance_m": nulland"duration_s": null. modeandavoidwork as in directions. Withtransit, every cell is null for now.- Over 100 cells answers
400 too_many_cellsand counts nothing.
Coverage
All of Nigeria once the Nigeria release is deployed. Gates and closed roads are known mostly in Lagos.