Migrate to Distance Matrix AI

Distance Matrix API

Introduction
This document will guide you through the different request and response parameters of DistanceMatrix API and how you can extract data analogous to the Google Distance Matrix service from DistanceMatrix API.
Distance Matrix request
Google:
GET
https://maps.googleapis.com/maps/api/distancematrix/json
?origins=<origin_location_1|origin_location_2|...|origin_location_n>
&destinations=<destination_location_1|destination_location_2|...|destination_location_n>
&key=<your_access_token>
Distancematrix.ai:
GET
https://api.distancematrix.ai/maps/api/distancematrix/json
?origins=<origin_location_1|origin_location_2|...|origin_location_n>
&destinations=<destination_location_1|destination_location_2|...|destination_location_n>
&key=<your_access_token>
Distance Matrix example request
Google:
GET
https://maps.googleapis.com/maps/api/distancematrix/json
?origins=51.4822656,-0.1933769
&destinations=Westminster Abbey, Westminster, London SW1P 3PA, UK
&key=<your_access_token>
Distancematrix.ai:
GET
https://api.distancematrix.ai/maps/api/distancematrix/json
?origins=51.4822656,-0.1933769
&destinations=Westminster Abbey, Westminster, London SW1P 3PA, UK
&key=<your_access_token>
Required & Response parameters
Parameters in a request (part of the URL) is the same in both cases:
1. list of origin locations (source <longitude,latitude> location coordinates or address) separated with vertical bar "|").
2. list of destination locations (source <longitude,latitude> location coordinates or address) separated with vertical bar "|").
3. key (your access token authorized to access the resource).
Response in JSON format (is the same in both cases):
- The unit of value of durations is second.
- The unit of value of distances is meter.
- Meant for car routing to get the duration considering live traffic.
- The coordinates pairs on which route is to be calculated. Minimum two pairs needed.
Distance Matrix example response
Google:
GET
{
  "destination_addresses":["Westminster Abbey, Westminster, 
  London SW1P 3PA, UK"],
  "origin_addresses":["Chapel, Fulham, London SW6 1BA, UK"],
  "rows":[
    {
      "elements":[
        {
          "distance":{
            "text": "4.7 mi",
            "value": 7564
          },
          "duration":{
            "text": "28 mins",
            "value": 1680
          },
          "duration_in_traffic":{
            "text": "28 mins",
            "value": 1680
          },
          "status": "OK"
        }
      ]
    }
  ],
  "status": "OK"
}
Distancematrix.ai:
GET
{
  "destination_addresses":["Westminster Abbey, Westminster, 
  London SW1P 3PA, UK"],
  "origin_addresses":["Chapel, Fulham, London SW6 1BA, UK"],
  "rows":[
    {
      "elements":[
        {
          "distance":{
            "text": "4.7 miles",
            "value": 7563.898
          },
          "duration":{
            "text": "28 min",
            "value": 1680
          },
          "duration_in_traffic":{
            "text": "28 min",
            "value": 1680
          },
          "status": "OK"
        }
      ]
    }
  ],
  "status": "OK"
}
Fill in the form and get a free 7 days trial period for Distance Matrix API
Tell us more about your project and we'll help you to choose the best solution and pricing plan.
Name
Link to your website or your company name and job position
Email where to send a token and instructions
What is the most comfortable channel to communicate with you?
Volume of elements (origin-destination pairs) per month:
Have you ever used Google Distance Matrix API or any other similar API before?
You agree with our Terms and Conditions
Made on
Tilda