A REST API that provides driving distance and time from a given centre point to any number of points.
- Basic URL structure:
The output format would be JSON.
- HTTP Request Method:
The input parameters will be supported in the Driving Distance API request are as below:
- licence_key: the REST API licence key allocated to you by signing into our services and
registering yourself as a developer (28 Char Alphanumeric).
- center: the WGS coordinates of the centre location from which the route distance is calculated. The format of the coordinate is Latitude,Longitude: e.g. 28.6976,77.9749.
- pts: coordinates of location whose distance from centre are calculated. Format for each coordinate is the same as for the centre, and they are | delimited, for example 29.2074,78.9475|30.0763,78.0807.
Please Note: A maximum of 10 locations can be used for distance calculation from centre.
- rtype: type of route (integer) required for navigation, where values mean:
- 0 quickest (default)
- 1 shortest
e.g. to get quickest route between two places,
- vtype: vehicle type (integer), where values mean:
- 0: passenger
1: taxi (default)
e.g. if travelling via public transport,
Note: Select “passenger” if travelling via Public Transport while you can select “taxi” for personal transport.
- avoids: The parameter to avoid road types along the route with default value “None (0) or (0000)”
To get correct combination for your preferred avoidances: Refer to the below table:
Here x is replaced by Boolean ‘1’ indicating the type of road you wish to avoid. Combine the
above 4 bits and convert the resulting 4-bit binary to decimal notation to derive your valid
input value for the API. Examples:
- 1: avoid toll roads (binary: 0001)
- 2: avoid ferries (binary: 0010)
- 6: avoid unpaved roads and ferries (binary: 0110)
- 10: avoid highways and ferries (binary: 1010)
e.g. to get alternative routes
The Driving Distance API will respond with an enveloped response with a collection of results object. The response information is as below:
- responseCode (integer): The response code of the operation.
The 400 series is for client side (yours) error while 500 series
for server side (ours) error, 200 for success.
- version (string): The version of the API you’re connected to.
- results (object [ ]): a collection of response objects, each consisting of the following properties:
- duration (integer): Duration of route in seconds. (Number)
- status (integer): Status set by routing engine: 6 means OK, any other number represents specific routing error. (Number)
- length (integer): Length of route in meters. (Number)
The Distance API must respond within 100 ms under all circumstances on a stable internet connection although on an unstable one, response times may vary.
Also, with the addition of each point response times may vary depending upon the complexity of the route of which the distance has to be calculated.
One Transaction for Distance Matrix API is equivalent to distance requested between two sets of Latitude-Longitude. Up to 10 distance calculations are allowed in one request.
E.g. distance from x,y to x1,y1 and x2,y2 is requested, then its counted as 2 transactions.
- To calculate driving distance between two points.
- To calculate travel time to a specific latitude and longitude from a centre location.
- To calculate driving distance and travel time from a single location to multiple locations