Skip to main content

Get Distance and Route

Calculate the distance and draw the shortest route between the coordinates in the order

HTTP Request

curl -X GET \
'https://ep.ahamove.com/routing/{profile}/route/v1/driving/{coordinates}'\
-H 'api-key: {apiKey}'

GET https://ep.ahamove.com/routing/{profile}/route/v1/driving/{coordinates}

KeyValue
api-keyThe apiKey that partners received from team Onwheel of Ahamove

Query Parameters

ParameterTypeRequiredDescription
profileStringYescar or bike. Type of vehicle
coordinatesStringYesThe longitude, latitude of the pick-up and drop-off points with the format: lng[0],lat[0];lng[1],lat[1]; ...

Sample Request

curl -X GET \
'https://ep.ahamove.com/routing/bike/route/v1/driving/106.662262,10.955419;106.692807,10.791757'\
-H 'api-key: {apiKey}'

Response

Status-Code: 200 OK

JSON response example:

{
"code": "Ok",
"routes": [ # An array of Route objects
{
"geometry": "ovzaA{l_jS}{@og@pXal@hn@aIjj@_kAjTaHoFuEhK_Z~~Aik@lmA`J~jAwP|Ggv@~uAy^zg@oYfKdDrbAcg@vLt\\`UcFbrAhf@te@rAp`@jXz_A{@hu@`Hjb@dU~cAOrLvUnu@~q@yGlHTvR",
"legs": [
{
"steps": [],
"summary": "",
"weight": 6578.4,
"duration": 6578.4,
"distance": 26292.8
}
],
"weight_name": "duration",
"weight": 6578.4,
"duration": 6578.4, # Estimated time to complete the route (in seconds)
"distance": 26292.8
}
],
"waypoints": [ # Array of Waypoint objects representing all waypoints in order
{
"hint": "BIoJgFJvbIA_AAAAEAEAACEAAAAAAAAAOSbTQbZ24kJHwF5BAAAAAD8AAAAQAQAAIQAAAAAAAAA6AgAAsIhbBrEqpwB2iVsGmyqnAAEArwsk0y4r",
"distance": 21.777153493,
"name": "Võ Minh Đức",
"location": [
106.662064,
10.955441
]
},
{
"hint": "KCUJgP___3-0AAAAIgEAAAAAAAAAAAAAGipIQqSN80EAAAAAAAAAALQAAAAiAQAAAAAAAAAAAAA6AgAAygBcBharpADHAFwGTaukAAAAvxAk0y4r",
"distance": 6.092561625,
"name": "Đường Nguyễn Phi Khanh",
"location": [
106.69281,
10.791702
]
}
]
}

Errors

CodeTextDescription
400Bad Request- Query string malformed
- Number of coordinates needs to be at least two
401UnauthorizedInvalid authentication credentials, api-key not found
404Not FoundProfile not found
500Internal Server ErrorWe had a problem with our server. Try again later.