Distance Matrix /distancematrix

Distance calculation for a matrix of origin and destination points.

Request Schema

https://api.visicom.ua/data-api/5.0/core/distancematrix.json?[origins][&destinations][&locks][&mode][&key][&callback]

Request Parameters

ParameterDescription
origins|oArray of origin point coordinates. A point can be described by an object ID or by latitude and longitude in the form lng,lat, or in WKT format with no more than 25 points. The symbol , separates points when using object IDs. The symbol | separates points when using latitude and longitude.
destinations|dArray of destination point coordinates. A point can be described by an object ID or by latitude and longitude in the form lng,lat, or in WKT format with no more than 25 points. The symbol , separates points when using object IDs. The symbol | separates points when using latitude and longitude.
locks|lArray of coordinates representing blocked passages. A block is described by an object ID or by latitude and longitude in the form lng,lat. For driving routes, it prevents route calculation through the blocked location. Applicable only for driving and driving-shortest modes. The symbol , separates points when using object IDs. The symbol | separates points when using latitude and longitude.
mode|mRoute calculation mode. Supported values: driving (optimal route on road network), driving-shortest (shortest route on road network), direct (straight-line distance). Default mode is driving.
keyAuthorization key.
callbackFunction name for JSONP request.

Request Example

https://api.visicom.ua/data-api/5.0/core/distancematrix.json?origins=30.36277,50.51605|30.49667,50.49508|30.59761,50.45226|30.51383,50.44789&destinations=30.36277,50.51605|30.49667,50.49508|30.59761,50.45226|30.51383,50.44789&mode=driving-shortest&key=YOUR_API_KEY 

Response

The response is an array of rows. Each row contains distances from the corresponding origin point (origins) to all destination points (destinations).

{"rows": [
    [
        {"distance": 0, "status": "OK"},
        {"distance": 12110,"status": "OK"},
        {"distance": 22616,"status": "OK"},
        {"distance": 14885,"status": "OK"}
    ],
    [
        {"distance": 12442,"status": "OK"},
        {"distance": 0,"status": "OK"},
        {"distance": 13060,"status": "OK"},
        {"distance": 9323,"status": "OK"}
    ],
    [
        {"distance": 22793,"status": "OK"},
        {"distance": 14416,"status": "OK"},
        {"distance": 0,"status": "OK"},
        {"distance": 10177,"status": "OK"}
    ],
    [
        {"distance": 16747,"status": "OK"},
        {"distance": 10541,"status": "OK"},
        {"distance": 8706,"status": "OK"},
        {"distance": 0,"status": "OK"}
    ]
]}