Docs › Products
Directions
A route by car or on foot between two points, with turn-by-turn steps in English or Arabic, in miles or kilometres, avoiding tolls, highways, ferries or dirt roads.
What to send
POST https://map.wazli.com/api/maps/v1/directions with a key that has Directions and a JSON body of at most 4 KB:
| Field | What it is |
|---|---|
from, to | { lat, lng } each (needed). |
mode | "drive" (default) or "walk". |
unit | "mi" (default) or "km". |
lang | "en" (default) or "ar": the language of the steps. |
avoid | Driving only: a list of tolls, highways, ferries, dirt. Walking avoids nothing. |
Driving routes go round roads that are closed right now.
What comes back
{ route }. When no road joins the two points, the answer is 404 no_route; every error is on map.wazli.com/developers/errors.
| Field | What it is |
|---|---|
distance, unit | The whole trip, in the unit asked for. |
durationSec | How long it takes, in seconds. |
geometry | A GeoJSON LineString of [lng, lat] points to draw. |
steps | The turns, in order (below). |
hasToll | true when some of the trip is on toll roads. |
via | The one or two roads most of the trip is on. |
| Step field | What it is |
|---|---|
instruction | What to do, in the language asked for. |
type | The kind of turn, as a Valhalla maneuver number (for an icon). |
distance, durationSec | This step's length and time. |
beginShapeIndex | Where the step starts on geometry (a point index). |
street | The road the step takes. |
lanes | The lanes before the turn, left to right: { directions, active }. |
exitNumber | Which roundabout exit to take. |
exitSign | What a highway exit's sign says: { number, branches, toward }. |
Answer (shortened)
{
"route": {
"distance": 24.5667,
"unit": "mi",
"durationSec": 2078,
"geometry": { "type": "LineString", "coordinates": [[-81.378772, 28.538071], ...] },
"steps": [
{
"instruction": "Drive south on South Orange Avenue/SR 527.",
"type": 2,
"distance": 0.07,
"durationSec": 10,
"beginShapeIndex": 0,
"street": "South Orange Avenue"
},
...
{
"instruction": "Turn right onto Boone Avenue.",
"type": 10,
"distance": 0.1193,
"durationSec": 23,
"beginShapeIndex": 15,
"street": "Boone Avenue",
"lanes": [
{ "directions": ["left"] },
{ "directions": ["through"] },
{ "directions": ["through", "right"], "active": "right" }
]
},
...
],
"hasToll": false,
"via": ["I 4 West", "Epcot Center Drive"]
}
}Example
curl
curl -X POST "https://map.wazli.com/api/maps/v1/directions" \
-H "X-Wazli-Key: YOUR_SERVER_KEY" \
-H "Content-Type: application/json" \
-d '{"from":{"lat":28.538,"lng":-81.379},"to":{"lat":28.4177,"lng":-81.5812},"mode":"drive","unit":"mi","avoid":["tolls"]}'