Direction

Get Route Directions

Calculates the best driving route between two points, with optional waypoints, and returns the travel time, total distance and the route as coordinates. With `alternative=t`, other possible routes come back in `alternates`.

GET
/api/route/direction/

Calculates the best driving route between two points, with optional waypoints, and returns the travel time, total distance and the route as coordinates. With alternative=t, other possible routes come back in alternates.

Query Parameters

origin*string

Starting point of the route in the format {latitude,longitude}.

destination*string

Ending point of the route in the format {latitude,longitude}.

apiKey*string

API key used to authenticate the request.

waypoints?string

An optional list of intermediate points the route must pass through, formatted as an array of {latitude,longitude} pairs.

alternative?"t"

Set to t to also get other possible routes, in alternates.

Value in"t"

Response Body

The route, and alternatives if requested.

application/json
  1. response
msg?string
timetaken?number

Travel time in seconds.

totalDistance?number

Route length in meters.

direction?array<array<number>>

The route as [lat, lng] points.

alternates?array<>

Other possible routes. Only present with alternative=t.

curl -X GET 'https://mapapi.gebeta.app/api/route/direction/?origin=%7B8.987685259188599%2C38.764792722654455%7D&destination=%7B9.087685259188599%2C38.764792722654455%7D&apiKey=your-api-key-here&waypoints=%5B%7B8.9879443%2C+38.7651287%7D%5D'
{  "msg": "Ok",  "timetaken": 1275.631,  "totalDistance": 8895,  "direction": [    [      9.055978,      38.704943    ],    [      9.056214,      38.704691    ]  ],  "alternates": [    {      "timetaken": 1182.037,      "totalDistance": 8425,      "direction": [        [          9.055978,          38.704943        ]      ]    },    {      "timetaken": 1404.338,      "totalDistance": 10585,      "direction": [        [          9.055978,          38.704943        ]      ]    }  ]}