v1

latestOpenAPI 3.1.02026-08-0420183200.9 KB
Routing

Calculate a time distance matrix for use in an optimizer.

The time distance matrix API lets you compare travel times between a set of possible start and end points. See https://docs.stadiamaps.com/limits/ for documentation of our latest limits.

post/matrix/v1

Request body

idstring

An identifier to disambiguate requests (echoed by the server).

costing'auto' | 'auto_traffic' | 'auto_traffic_premium' | 'bus' | 'bus_traffic' | 'bus_traffic_premium' | 'taxi' | 'taxi_traffic' | 'taxi_traffic_premium' | 'truck' | 'truck_traffic' | 'truck_traffic_premium' | 'bicycle' | 'bikeshare' | 'motor_scooter' | 'motorcycle' | 'pedestrian' | 'low_speed_vehicle' required
matrix_locationsinteger

Only applicable to one-to-many or many-to-one requests. This defaults to all locations. When specified explicitly, this option allows a partial result to be returned. This is basically equivalent to "find the closest/best locations out of the full set." This can have a dramatic improvement for large requests.

units'km' | 'mi'
language'bg-BG' | 'ca-ES' | 'cs-CZ' | 'da-DK' | 'de-DE' | 'el-GR' | 'en-GB' | 'en-US-x-pirate' | 'en-US' | 'es-ES' | 'et-EE' | 'fi-FI' | 'fr-FR' | 'hi-IN' | 'hu-HU' | 'it-IT' | 'ja-JP' | 'nb-NO' | 'nl-NL' | 'pl-PL' | 'pt-BR' | 'pt-PT' | 'ro-RO' | 'ru-RU' | 'sk-SK' | 'sl-SI' | 'sv-SE' | 'tr-TR' | 'uk-UA'
directions_type'none' | 'maneuvers' | 'instructions'

The level of directional narrative to include. Locations and times will always be returned, but narrative generation verbosity can be controlled with this parameter.

Example request

{
  "costing": "pedestrian",
  "sources": [
    {
      "lat": 40.744014,
      "lon": -73.990508
    }
  ],
  "targets": [
    {
      "lat": 40.744014,
      "lon": -73.990508
    },
    {
      "lat": 40.739735,
      "lon": -73.979713
    },
    {
      "lat": 40.752522,
      "lon": -73.985015
    },
    {
      "lat": 40.750117,
      "lon": -73.983704
    },
    {
      "lat": 40.750552,
      "lon": -73.993519
    }
  ]
}

Response

A matrix of times and distances between the start and end points.

idstring

An identifier to disambiguate requests (echoed by the server).

units'miles' | 'kilometers' required

Example response

{
  "sources": [
    [
      {
        "lat": 40.744014,
        "lon": -73.990508
      }
    ]
  ],
  "sources_to_targets": [
    [
      {
        "distance": 0,
        "from_index": 0,
        "time": 0,
        "to_index": 0
      },
      {
        "distance": 1.115,
        "from_index": 0,
        "time": 806,
        "to_index": 1
      },
      {
        "distance": 1.278,
        "from_index": 0,
        "time": 909,
        "to_index": 2
      },
      {
        "distance": 1.112,
        "from_index": 0,
        "time": 792,
        "to_index": 3
      },
      {
        "distance": 1.22,
        "from_index": 0,
        "time": 869,
        "to_index": 4
      }
    ]
  ],
  "targets": [
    [
      {
        "lat": 40.744014,
        "lon": -73.990508
      },
      {
        "lat": 40.739735,
        "lon": -73.979713
      },
      {
        "lat": 40.752522,
        "lon": -73.985015
      },
      {
        "lat": 40.750117,
        "lon": -73.983704
      },
      {
        "lat": 40.750552,
        "lon": -73.993519
      }
    ]
  ],
  "units": "kilometers"
}