Distance Matrix

List of parameters

Mandatory parameters

  • calculationMode – Indicates the calculation mode for the route. Supports types:
    • THE_FASTEST – Consider it the fastest way.
    • THE_SHORTEST – Consider the route with the lowest mileage.
  • destinations – Description of destination points with:
    • siteId – Stop point identifier.
    • latitude – Latitude coordinate in decimal degrees.
    • longitude – Longitude coordinate in decimal degrees.
  • origins – Description of points of origin with:
    • siteId – Stop point identifier.
    • latitude – Latitude coordinate in decimal degrees.
    • longitude – Longitude coordinate in decimal degrees.
  • tripProfile – Identifier of the profile used to perform the route. Possible values ​​are:
    • MAPLINKBR – For routes located in Brazil;
    • MAPLINK – For routes located throughout Latin America;
    • LINEAR – With this profile, processing is significantly faster, but precision is lost, as the calculation will be based on the linear (Euclidean) distance between points, without considering the paths. Recommended only for problems with points that are far apart.

Example with mandatory parameters

{
    "calculationMode": "THE_FASTEST",
    "destinations": [
        {
            "latitude": -23.561402303338195, 
            "longitude": -46.63862145421187,
            "siteId": "destination1Liberdade"
        }
    ],
    "origins": [
        {
            "latitude": -23.55363650451996,
            "longitude": -46.620810158377516,
            "siteId": "origin1Mooca"
        }
    ],
    "tripProfile": "MAPLINK"
}

Optional parameters

  • avoidanceTypes – Indicates that the route will have to deviate from certain types of road system elements. Allowed values are: [TUNNELS, BRIDGES, FERRIES, TOLL_ROADS, TOLL_GATES].
  • callback – Object that contains the webhook data that will be used to receive the problem calculation events. This way, it will not be necessary to check the status of the problem to check if it has been processed. The API will notify the webhook when the solution is available for query. For more details, see: How to receive the current status of the problem via webhook?
    • url – URL with the address that will receive the callback.
    • user – (Optional) Text with the user name if the endpoint requires authentication.
    • password – (Optional) Password text if the endpoint requires authentication.
  • restrictionZones – Array with the text of the name of the restriction area previously registered in the Restriction Zone API.

Example with optional parameters

{
    "avoidanceTypes": [
        "TUNNELS",
        "BRIDGES",
        "FERRIES",
        "TOLL_ROADS",
        "TOLL_GATES"
    ],
    "calculationMode": "THE_FASTEST",
    "destinations": [
        {
            "latitude": -23.682211,
            "longitude": -46.546867,
            "siteId": "SantoAndre"
        }
    ],
    "origins": [
        {
            "latitude": -23.337132,
            "longitude": -46.835427,
            "siteId": "Cajamar"
        }
    ],
    "restrictionZones": [],
    "tripProfile": "MAPLINK"
}