Skip to content
GuidesPlaygroundDashboard

Calculate a distance matrix between points

$ plaza routing matrix
POST/api/v1/matrix

Calculate a distance matrix between points

ParametersExpand Collapse
--destinations: object { coordinates, type }

Destination points (GeoJSON MultiPoint geometry)

--origins: object { coordinates, type }

Origin points (GeoJSON MultiPoint geometry)

--mode: optional "auto" or "foot" or "bicycle"

Travel mode

ReturnsExpand Collapse
matrix_result: object { distances, durations }
distances: array of array of number

Distance matrix (meters), origins x destinations

durations: array of array of number

Duration matrix (seconds), origins x destinations

Calculate a distance matrix between points

plaza routing matrix \
  --api-key 'My API Key' \
  --destinations '{coordinates: [0], type: Point}' \
  --origins '{coordinates: [0], type: Point}'
{
  "distances": [
    [
      0
    ]
  ],
  "durations": [
    [
      0
    ]
  ]
}
Returns Examples
{
  "distances": [
    [
      0
    ]
  ],
  "durations": [
    [
      0
    ]
  ]
}