Search APIs
Add Your API
MapboxDuration API thumbnail

MapboxDuration

API Overview

Connect to the Mapbox Directions API to get driving, walking, and cycling routes and directions. Test an API call in your browser and export the code snippet.

The Mapbox API has free and paid plans as of 03/08/2017: https://www.mapbox.com/pricing/

Get travel time between points (via walking, cycling, car).

MapboxDuration Package

Calculation of travel time (in sec) between points based on the type of transport

  • Domain: Mapbox
  • Credentials: accessToken

How to get credentials:

  1. Log in or Sign up for a Mapbox Account
  2. Navigate to your Account Settings to get your accessToken

Custom datatypes:

DatatypeDescriptionExample
DatepickerString which includes date and time2016-05-28 00:00:00
MapString which includes latitude and longitude coma separated50.37, 26.56
ListSimple array["123", "sample"]
SelectString with predefined valuessample
ArrayArray of objects[{"Second name":"123","Age":"12","Photo":"sdf","Draft":"sdfsdf"},{"name":"adi","Second name":"bla","Age":"4","Photo":"asfserwe","Draft":"sdfsdf"}]

MapboxDuration.getDrivingDuration

Сalculate the duration of travel by car

FieldTypeDescription
accessTokencredentialsThe api key obtained from Mapbox
coordinatesListList of Maps (coordinates) minimum 2 pairs of coordinates. Maximum 100 pairs.

MapboxDuration.getDrivingDurationByFile

Сalculate the duration of travel by car (json file coordinates)

FieldTypeDescription
accessTokencredentialsThe api key obtained from Mapbox
coordinatesFileFile with coordinates in json format. Maximum 100 pairs of coordinates like [[longitude1,latitude1], [longitude2,latitude2]].

MapboxDuration.getWalkingDuration

Сalculate the duration of travel by walking

FieldTypeDescription
accessTokencredentialsThe api key obtained from Mapbox
coordinatesListList of Maps (coordinates) minimum 2 pairs of coordinates. Maximum 100 pairs.

MapboxDuration.getWalkingDurationByFile

Сalculate the duration of travel by walking (json file coordinates)

FieldTypeDescription
accessTokencredentialsThe api key obtained from Mapbox
coordinatesFileFile with coordinates in json format. Maximum 100 pairs of coordinates like [[longitude1,latitude1], [longitude2,latitude2]].

MapboxDuration.getCyclingDuration

Сalculate the duration of travel by cycling

FieldTypeDescription
accessTokencredentialsThe api key obtained from Mapbox
coordinatesListList of Maps (coordinates) minimum 2 pairs of coordinates. Maximum 100 pairs.

MapboxDuration.getCyclingDurationByFile

Сalculate the duration of travel by cycling (json file coordinates)

FieldTypeDescription
accessTokencredentialsThe api key obtained from Mapbox
coordinatesFileFile with coordinates in json format. Maximum 100 pairs of coordinates like [[longitude1,latitude1], [longitude2,latitude2]].

Examples

MapboxDuration.getCyclingDuration

{
    "accessToken": "Your-accessToken-here",
    "coordinates": [{
        "-122.42,37.78",
        "-77.03, 38.91"
    }]
}

Response

{
    "callback":"success",
    "contextWrites":
    {
        "to":[
            {
                "code":"Ok",
                "durations":[
                    [0,14753.7,23437],
                    [14639.3,0,29524.6],
                    [22498.4,29708.1,0]
                ]
            }
        ]
    }
}

MapboxDuration.getCyclingDurationByFile coordinates.json

[
    [13.41894, 52.50055],
    [14.10293, 52.50055],
    [13.50116, 53.10293]
]

Response

{
    "callback": "success",
    "contextWrites": 
    {
        "to":[
            {
                "code": "Ok",
                "durations": [
                    [0,14753.7,23437],
                    [14639.3,0,29524.6],
                    [22498.4,29708.1,0]
                ]
            }
        ]
    }
}