Distance Matrix

Please note Sygic does no longer issue new Sygic Maps API keys. This documentation is for existing customers only. If you wish to include maps & navigation into your project, please refer to Sygic Maps SDK.

Overview

Sygic Distance Matrix supports up to 200 waypoints at the time. To access Sygic Distance Matrix API with limit above 200 waypoints, please refer to Sygic Batch Distance matrix API.

Request

API Reference

https://routing.api.sygic.com/v0/api/distancematrix?key=yourAPIkey

Request authentication is done via parameter key, which must be included in the request URL.

Methods

Method Description
GET Compatible with Google API, but recommended only for small calculation requests.
POST Standard method with more efficient response format, preferred for bigger requests.

Parameters

Required Parameters

Parameter Data type Description
key string The API key.
origins array Array of route origins in GPS coordinates format "{latitude},{longitude}". Separated by pipe character if included in GET request.

Example: 48.155441,17.107657|48.143065,17.122164|48.157704,17.166263
destinations array Array of route destinations in GPS coordinates format "{latitude},{longitude}". Separated by pipe character if included in GET request.

Example: 48.169207,7.138930|48.182423,17.054852|48.125317,17.097002

Optional Parameters

Parameter Data type Value Default Description
route_computing string fastest
shortest
fastest Type of route computing.
units string metric
imperial
metric System of units for returned distances.
vehicle_type string car
truck
car Defines type of vehicle. There are three supported types with following attributes:

car - normal passenger car
truck - vehicle bigger than car
max_speed number 1 - 255 Speed of vehicle in kilometers per hour.

Response

GET

GET https://directions.api.sygic.com/v0/api/distancematrix?origins=48.155441,17.107657|48.143065,17.122164|48.157704,17.166263&destinations=48.169207,17.138930|48.182423,17.054852|48.125317,17.097002&key=yourAPIkey

Response Body

{
    "origins": [
        "48.15544,17.10766",
        "48.14306,17.12216",
        "48.1577,17.16626"
    ],
    "destinations": [
        "48.16921,17.13893",
        "48.18242,17.05485",
        "48.12532,17.097"
    ],
    "rows": [
        {
            "elements": [
                {
                    "duration": {
                        "value": 293,
                        "text": "4 minutes 53 seconds"
                    },
                    "distance": {
                        "value": 2990,
                        "text": "2.99 km"
                    }
                },
                {
                    "duration": {
                        "value": 496,
                        "text": "8 minutes 16 seconds"
                    },
                    "distance": {
                        "value": 5603,
                        "text": "5.6 km"
                    }
                },
                {
                    "duration": {
                        "value": 460,
                        "text": "7 minutes 40 seconds"
                    },
                    "distance": {
                        "value": 5176,
                        "text": "5.18 km"
                    }
                }
            ]
        },
        {
            "elements": [
                {
                    "duration": {
                        "value": 319,
                        "text": "5 minutes 19 seconds"
                    },
                    "distance": {
                        "value": 3247,
                        "text": "3.25 km"
                    }
                },
                {
                    "duration": {
                        "value": 706,
                        "text": "11 minutes 46 seconds"
                    },
                    "distance": {
                        "value": 7736,
                        "text": "7.74 km"
                    }
                },
                {
                    "duration": {
                        "value": 468,
                        "text": "7 minutes 48 seconds"
                    },
                    "distance": {
                        "value": 5732,
                        "text": "5.73 km"
                    }
                }
            ]
        },
        {
            "elements": [
                {
                    "duration": {
                        "value": 321,
                        "text": "5 minutes 21 seconds"
                    },
                    "distance": {
                        "value": 3268,
                        "text": "3.27 km"
                    }
                },
                {
                    "duration": {
                        "value": 902,
                        "text": "15 minutes 2 seconds"
                    },
                    "distance": {
                        "value": 9733,
                        "text": "9.73 km"
                    }
                },
                {
                    "duration": {
                        "value": 718,
                        "text": "11 minutes 58 seconds"
                    },
                    "distance": {
                        "value": 8865,
                        "text": "8.87 km"
                    }
                }
            ]
        }
    ],
    "status": "OK",
    "copyright": "© 2018 Sygic a.s."
}

POST

POST https://directions.api.sygic.com/v0/api/distancematrix?key=yourAPIkey
Content-Type: application/json
{
    "origins": [
        "48.15544,17.10766",
        "48.14306,17.12216",
        "48.1577,17.16626"
    ],
    "destinations": [
        "48.16921,17.13893",
        "48.18242,17.05485",
        "48.12532,17.097"
    ]
}

Response Body

{
    "origins": [
        "48.15544,17.10766",
        "48.14306,17.12216",
        "48.1577,17.16626"
    ],
    "destinations": [
        "48.16921,17.13893",
        "48.18242,17.05485",
        "48.12532,17.097"
    ],
    "distances": [
        [
            2990,
            5603,
            5176
        ],
        [
            3247,
            7736,
            5732
        ],
        [
            3268,
            9733,
            8865
        ]
    ],
    "durations": [
        [
            293,
            496,
            460
        ],
        [
            319,
            706,
            468
        ],
        [
            321,
            902,
            718
        ]
    ],
    "status": "OK",
    "copyright": "© 2018 Sygic a.s."
}