Skip to content
GuidesBlogPlaygroundDashboard

Calculate a distance matrix between points

routing.matrix(RoutingMatrixParams**kwargs) -> MatrixResult
POST/api/v1/matrix

Calculate a distance matrix between points

ParametersExpand Collapse
destinations: Iterable[Destination]

Array of destination coordinates (max 50)

lat: float

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: float

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
origins: Iterable[Origin]

Array of origin coordinates (max 50)

lat: float

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: float

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
annotations: Optional[str]

Comma-separated list of annotations to include: duration (always included), distance. Example: duration,distance.

fallback_speed: Optional[float]

Fallback speed in km/h for pairs where no route exists. When set, unreachable pairs get estimated values instead of null.

exclusiveMinimum
minimum0
mode: Optional[Literal["auto", "foot", "bicycle"]]

Travel mode (default: auto)

One of the following:
"auto"
"foot"
"bicycle"
ReturnsExpand Collapse
Dict[str, object]

Calculate a distance matrix between points

import os
from plaza import Plaza

client = Plaza(
    api_key=os.environ.get("PLAZA_API_KEY"),  # This is the default and can be omitted
)
matrix_result = client.routing.matrix(
    destinations=[{
        "lat": 48.8584,
        "lng": 2.2945,
    }],
    origins=[{
        "lat": 48.8566,
        "lng": 2.3522,
    }, {
        "lat": 48.8606,
        "lng": 2.3376,
    }],
)
print(matrix_result)
{
  "foo": "bar"
}
Returns Examples
{
  "foo": "bar"
}