Route API
Calculate a route between two points. Returns distance, duration, polyline (for map drawing), and turn by turn steps.
Endpoint
GET /v1/route
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| origin | string | Yes | lat,lng (e.g., 23.81,90.41) |
| destination | string | Yes | lat,lng |
| vehicle_type | string | No | car, bike, motorbike, pedestrian (default: car) |
Example
cURL
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://map.arohon.co/v1/route?origin=23.81,90.41&destination=23.75,90.37&vehicle_type=car"
JavaScript
const res = await fetch(
'https://map.arohon.co/v1/route?origin=23.81,90.41&destination=23.75,90.37&vehicle_type=car',
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const data = await res.json();
Python
import requests
r = requests.get(
'https://map.arohon.co/v1/route',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={'origin': '23.81,90.41', 'destination': '23.75,90.37', 'vehicle_type': 'car'}
)
route = r.json()
Response
{
"distance": 10.89,
"duration": 642,
"polyline": "encoded_polyline_string",
"steps": [
{
"instruction": "Head north",
"distance": 150,
"duration": 20
}
]
}
Polyline Decoding
The polyline field uses Valhalla polyline6 (factor 1e6). See Get Started for the decoder.