api.automapa.comv3 - all systems normal

Distance matrix

Routes.matrix

Compute pairwise length and duration between a set of points.

POST/v3/Routes/matrixapi.automapa.com

Body parameters

BodyTypeDescription
pointsdouble[][] REQUIREDArray of [x, y] coordinates.
typeinteger REQUIRED1 = optimise by time, 2 = by length.
preciseboolExact coordinates (vs. ~500m rounding). Default false.
simplebooltrue = unique pairs only; false = full each-with-each.

Example request

{
    "points": [
        [
            20.5334473,
            53.7373403
        ],
        [
            17.0178223,
            52.33701732
        ],
        [
            16.9299316,
            51.0603863
        ],
        [
            20.8355713,
            52.1958233
        ]
    ],
    "type": 1,
    "precise": false,
    "simple": true
}

Example response

{
    "result": [
        {
            "length": 482244,
            "duration": 229,
            "points": "0-1"
        },
        {
            "length": 224693,
            "duration": 141,
            "points": "0-3"
        },
        {
            "length": 291469,
            "duration": 141,
            "points": "1-3"
        },
        {
            "length": 539275,
            "duration": 309,
            "points": "0-2"
        },
        {
            "length": 204062,
            "duration": 102,
            "points": "1-2"
        },
        {
            "length": 350647,
            "duration": 165,
            "points": "2-3"
        }
    ]
}

result fields

result fieldsTypeDescription
pointsstringPair indices, e.g. "0-1".
lengthintegerLength in metres.
durationintegerDuration in minutes.