Navigation API
Get route directions between two points with turn-by-turn instructions. Supports driving (with traffic), walking, and cycling profiles. Instructions are available in French, Arabic, and English.
Get Directions
Calculate a route between an origin and destination. The response includes a GeoJSON LineString geometry for map rendering, total distance and duration, and step-by-step navigation instructions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
originLatitude | number | Required | Latitude of the starting point(e.g. 18.0858) |
originLongitude | number | Required | Longitude of the starting point(e.g. -15.9785) |
destinationLatitude | number | Required | Latitude of the destination(e.g. 18.1012) |
destinationLongitude | number | Required | Longitude of the destination(e.g. -15.9507) |
profile | string | Optional | Routing profile: "driving-traffic" (default), "walking", or "cycling"(e.g. driving-traffic) |
language | string | Optional | Language for turn-by-turn instructions: fr, ar, or en(e.g. fr) |
alternates | number | Optional | Number of alternative routes to return (0-3, default: 0)(e.g. 2) |
Routing Profiles
driving-trafficCar routes with real-time traffic data. Default profile.
walkingPedestrian routes using footpaths and sidewalks.
cyclingBicycle routes preferring bike-friendly roads.
Example Request
curl -X GET "https://api.oolel.com/navigation/directions?\
originLatitude=18.0858&\
originLongitude=-15.9785&\
destinationLatitude=18.1012&\
destinationLongitude=-15.9507&\
profile=driving-traffic&\
language=fr&\
alternates=1" \
-H "Authorization: Bearer YOUR_API_KEY"Example Response
{
"routes": [
{
"distance": 4250,
"duration": 612,
"geometry": {
"type": "LineString",
"coordinates": [
[-15.9785, 18.0858],
[-15.9762, 18.0871],
[-15.9701, 18.0923],
[-15.9598, 18.0967],
[-15.9507, 18.1012]
]
},
"legs": [
{
"distance": 4250,
"duration": 612,
"steps": [
{
"instruction": "Dirigez-vous vers le nord-est sur Avenue Gamal Abdel Nasser",
"distance": 850,
"duration": 124,
"maneuver": {
"type": "depart",
"modifier": "right",
"location": [-15.9785, 18.0858]
}
},
{
"instruction": "Tournez a droite sur Route de l'Ambassade",
"distance": 1200,
"duration": 185,
"maneuver": {
"type": "turn",
"modifier": "right",
"location": [-15.9762, 18.0871]
}
},
{
"instruction": "Continuez tout droit pendant 1.4 km",
"distance": 1400,
"duration": 203,
"maneuver": {
"type": "continue",
"modifier": "straight",
"location": [-15.9701, 18.0923]
}
},
{
"instruction": "Vous etes arrive a destination",
"distance": 0,
"duration": 0,
"maneuver": {
"type": "arrive",
"modifier": "straight",
"location": [-15.9507, 18.1012]
}
}
]
}
]
}
],
"waypoints": [
{
"name": "Avenue Gamal Abdel Nasser",
"location": [-15.9785, 18.0858]
},
{
"name": "Route de Nouadhibou",
"location": [-15.9507, 18.1012]
}
]
}Usage Notes
Geometry Format
The route geometry is returned as a GeoJSON LineString with coordinates in [longitude, latitude] order, following the GeoJSON specification. This can be directly rendered on MapLibre GL, Leaflet, or any GeoJSON-compatible mapping library.
Maneuver Types
Each step includes a maneuver object with a type (depart, turn, continue, merge, roundabout, arrive) and a modifier (left, right, straight, slight left, slight right, sharp left, sharp right, uturn). Use these for custom navigation UIs.
Alternative Routes
Set alternates=2 to receive up to 2 alternative routes alongside the primary route. Alternative routes are returned in the same routes array, sorted by duration (fastest first).