MapScale Docs
•••
MapScale API
POST/v1/matrix

Calculate a route matrix

Compare travel times and distances between multiple source and target coordinates.

LIVE API PLAYGROUND

Sign in or create an account

Continue to run live requests directly from the docs.

Sends this request to the live API and shows the real response.

Equivalent request
curl \
  -X POST \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sources":[[100.5018,13.7563],[100.5348,13.7466]],"targets":[[100.5231,13.7367],[100.5601,13.7279]],"profile":"driving"}' \
  "https://api.mapscale.io/v1/matrix"
Response
Default response
{
  "code": "Ok",
  "durations": [
    [
      420,
      690
    ],
    [
      310,
      540
    ]
  ],
  "distances": [
    [
      3200,
      6100
    ],
    [
      2100,
      4700
    ]
  ],
  "sources": [
    {
      "location": [
        100.5018,
        13.7563
      ]
    },
    {
      "location": [
        100.5348,
        13.7466
      ]
    }
  ],
  "destinations": [
    {
      "location": [
        100.5231,
        13.7367
      ]
    },
    {
      "location": [
        100.5601,
        13.7279
      ]
    }
  ]
}

Request body

Required · application/json

application/json
{
  "sources": [
    [
      100.5018,
      13.7563
    ],
    [
      100.5348,
      13.7466
    ]
  ],
  "targets": [
    [
      100.5231,
      13.7367
    ],
    [
      100.5601,
      13.7279
    ]
  ],
  "profile": "driving"
}

Responses

200Matrix computedapplication/json
400Invalid requestapplication/json
401mapscale/effect-api/UnauthorizedFailureapplication/json
403mapscale/effect-api/ForbiddenFailureapplication/json
404No route was foundapplication/json
429mapscale/effect-api/RateLimitedFailureapplication/json
500mapscale/effect-api/MiddlewareInternalFailureapplication/json
502Upstream routing engine failureapplication/json
503Upstream routing engine unavailable | mapscale/effect-api/UpstreamUnavailableFailureapplication/json

On this page