Matrix
Travel-time and distance matrices. The headline capability.
Travel-time and distance matrix
Computes durations and/or distances between every source and every destination.
Cost: |sources| x |destinations| elements. Omitting sources or destinations
selects every location, so a request with n locations and neither field costs n².
The literal selector ["all"] means the same thing.
Maximum size: 90,000 elements per request (300 x 300) on current plans. The engine behind this API refuses more than 100,000; requests above your plan's limit are refused here, before any work is done, with the same error the engine would have given.
path Parameters
profileThe routing profile. driving-car is the only profile served. Any other value
returns the engine's own error, the same one hosted openrouteservice returns for a
profile it does not carry.
Headers
AuthorizationThe Authorization header is used to authenticate with the API using your API key. Value is of the format Bearer YOUR_KEY_HERE.
Travel-time and distance matrix › Request Body
locationsThe points the matrix is computed over. At least two.
sourcesIndices into locations to use as sources. Omit, or send ["all"], for every
location. This field is half of what the request costs.
destinationsIndices into locations to use as destinations. Omit, or send ["all"], for every
location. This field is the other half of what the request costs.
metricsWhich matrices to return. Defaults to durations only.
resolve_locationsReturn the name of the nearest road for each snapped point.
unitsUnits for the distance matrix. Durations are always seconds.
idAn arbitrary identifier echoed back in the response metadata.
Travel-time and distance matrix › Responses
The computed matrix.
durationsTravel times in seconds, as rows of sources by columns of destinations. A null
entry means no route was found between that pair.
distancesDistances, present only when requested via metrics.
The engine's metadata block, passed through unchanged, plus our added element count.
Travel-time and distance matrix (explicit JSON form)
Identical to POST /v2/matrix/{profile}. This is the path openrouteservice-py sends,
so it exists for the same reason the bare path does: a client library already uses it.
path Parameters
profileThe routing profile. driving-car is the only profile served. Any other value
returns the engine's own error, the same one hosted openrouteservice returns for a
profile it does not carry.
Headers
AuthorizationThe Authorization header is used to authenticate with the API using your API key. Value is of the format Bearer YOUR_KEY_HERE.
Travel-time and distance matrix (explicit JSON form) › Request Body
locationsThe points the matrix is computed over. At least two.
sourcesIndices into locations to use as sources. Omit, or send ["all"], for every
location. This field is half of what the request costs.
destinationsIndices into locations to use as destinations. Omit, or send ["all"], for every
location. This field is the other half of what the request costs.
metricsWhich matrices to return. Defaults to durations only.
resolve_locationsReturn the name of the nearest road for each snapped point.
unitsUnits for the distance matrix. Durations are always seconds.
idAn arbitrary identifier echoed back in the response metadata.
Travel-time and distance matrix (explicit JSON form) › Responses
The computed matrix.
durationsTravel times in seconds, as rows of sources by columns of destinations. A null
entry means no route was found between that pair.
distancesDistances, present only when requested via metrics.
The engine's metadata block, passed through unchanged, plus our added element count.