Driving Distance Matrix API

Adding driving directions API would help to add predicted travel time & duration from a given origin point to a number of points. The Driving Distance Matrix API provides driving distance and estimated time to go from a start point to multiple destination points, based on recommended routes from MapmyIndia Maps and traffic flow conditions


  • Basic URL structure:
  • Output:
    The output format would be JSON.
  • HTTP Request Method: GET

Request Parameters

The input parameters will be supported in the Driving Distance API request are as below:

  1. licence_key: the REST API licence key allocated to you by signing into our services and
    registering yourself as a developer (28 Char Alphanumeric).
  2. 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.
  3. 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.
  4. 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,
  5. 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.
  6. avoids: The parameter to avoid road types along the route with default value “None (0) or (0000)”
    Please Note: To get correct combination for your preferred avoidances: Refer to the below table:
    Highways Unpaved roads Ferries Toll roads
    x x x x
    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: 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 https://apis.mapmyindia.com/advancedmaps/v1//distance?center=,&pts=<lat1,lng1|lat2,lng2>&avoids=10
  7. with_traffic: The parameter is to check distance along the traffic with default value “0”
    0 : Without traffic
    1 : With traffic
    e.g to get ditance with traffic https://apis.mapmyindia.com/advancedmaps/v1//distance?center=,&pts=<lat1,lng1|lat2,lng2>&avoids=<avoids>&with_traffic=1

Response Parameters

The Driving Distance API will respond with an enveloped response with a collection of results object. The response information is as below:

  1. 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.
  2. version (string): The version of the API you’re connected to.
  3. 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.

Transaction Information

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.

Use Cases

  • 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




{  "responseCode": 200,  "version": "130.10",  "results": [  {  "duration": 14232,  "length": 120395,  "status": 6  },  {  "duration": 18673,  "length": 206801,  "status": 6  },  {  "duration": 22812,  "length": 239163,  "status": 6  }  ]  }