Matrix API

Matrix API

The API is similar to Distance Matrix only difference is that it can provide a route between multiple points. This will be more suitable for use cases where you need to find the distance and travel time between a single pickup and multiple delivery points. The Matrix API allows you to efficiently check the reachability of coordinates from each other, and filter points by travel time. One API hit corresponds to 10 transactions.

Parameters Required

Name Type Description
fm_token String Enter Mappr token available in Mappr dashboard.
start string Starting points. Multiple latitudes and longitudes separated by semicolon.
example: start=30.7194022,76.7646552;30.6975401,76.8551066
end string Ending points. Multiple latitudes and longitudes separated by semicolon.
example: end=30.76180185,76.8017019760213;30.75180185,76.8017019760213
type(optional) String Type can be Android, iOS or Web.

Request

https://maps.flightmap.io/api/matrix?fm_token=<your flightmap key>&start=30.7194022,76.7646552;30.6975401,76.8551066&end=30.76180185,76.8017019760213;30.75180185,76.8017019760213

Response

Response is an MxN matrix assigned to a key named ‘routes‘. ‘Routes‘ is an array of objects. Each object in ‘routes’ represents a source (M) that contains a key ‘elements’. ‘Elements’ is an array of objects containing distance and duration values for each destination (N) from source (M).

*Note : [ units:- duration: milliseconds,distance: meters ]

Below is a sample response, in JSON:

{ 
   "routes":[ 
      { 
         "elements":[ 
            { 
               "counter":0,
               "distance":8262.152,
               "duration":570683
            },
            { 
               "counter":1,
               "distance":12892.152,
               "duration":916473
            }
         ]
      },
      { 
         "elements":[ 
            { 
               "counter":0,
               "distance":5868.641,
               "duration":392880
            },
            { 
               "counter":1,
               "distance":10498.641,
               "duration":738670
            }
         ]
      }
   ]
}

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

To read more about our Distance Matrix API kindly refer to this link: https://help.jungleworks.com/mappr/distance-matrix-api/

Leave A Comment?