Distance Matrix API

Distance Matrix API

The Distance Matrix API enables you to calculate, evaluate and plan your routes to improve your customers’ online experience and enhance your business efficiency. This API finds the best possible distance between the origin latitude, and longitude and the destination latitude, and longitude.

API features

  1. Providing the route duration.
  2. Distance is calculated to account for users who are driving, walking, bicycling, or using public transport.
  3. The Distance Matrix API can forecast travel times, taking into account departure and arrival times.
  4. We handle 3 requests per second, and the request will have all the information such as from and to locations.

How does it work?

The Distance API returns the trip duration in seconds and the distance in meters to show the fastest route between the coordinates of the selected points. 

For example: You need to find the distance and travel time between the following address points on the map:

Point 1: 1677 Easton Rd, Willow Grove, PA 19090, USA

Point 2: 119 S Easton Rd, Glenside, PA 19038, USA

Our API geocode returns these queries as point coordinates:

40.1349979,-75.1228148

40.1000254,-75.1540458

The Distance Matrix API then returns distance and travel time data on the queries with point coordinates. The API response contains a distance matrix in JSON format.

For example, 310 meters and 2600 seconds

 

Parameters Required

Name Type Description
fm_token String Enter Mappr token available in Mappr dashboard
originlatitude numeric Enter the source latitude.
originlongitude numeric Enter the source longitude.
destinationlatitude numeric Enter the destination latitude.
destinationlongitude numeric Enter the destination longitude.
type String type can be Android, iOS or Web

 

Request

The following example requests the distance to show the best possible distance between two places

https://maps.flightmap.io/api/distancematrix?fm_token=<your api key here>&originlatitude=30.71940&originlongitude=76.7646552&destinationlatitude=21.1500964&destinationlongitude=79.0127048991

 

Response

Name Type Description
data object Complete information of the distance
distance String Display the distance between two places in KM
Time string Display the time in Minutes
ETA numeric Estimate Time Arrival in minutes
ETA_text String Estimate Time Arrival in string format
distance_in_meter numeric Distance in meters
time_in_second numeric Display time in seconds

Below is a sample response, in JSON:

{
      "message": "Successful",
      "status": 200,
      "data": {
        "distance": "1287.022459 KM",
        "Time": "1068.3301666666666 Minute",
        "ETA": 1071.3301666666666,
        "ETA_text": "17 hours 51 minutes",
        "distance_in_meter": 1287022.459,
        "time_in_second": 64099.81
      }
    }

Link to documentation: https://docs.jungleworks.com/flightmap/map/distanceMatrix-api

Leave A Comment?