Skip to content
GuidesPlaygroundDashboard

Calculate a route between two points

routing.route(RoutingRouteParams**kwargs) -> RouteResult
POST/api/v1/route

Calculate a route between two points

ParametersExpand Collapse

Destination point (GeoJSON Point geometry)

coordinates: Union[List[float], List[List[float]], List[List[List[float]]], List[List[List[List[float]]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
List[float]
List[List[float]]
List[List[List[float]]]
List[List[List[List[float]]]]
type: Literal["Point", "LineString", "Polygon", 3 more]
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"

Origin point (GeoJSON Point geometry)

coordinates: Union[List[float], List[List[float]], List[List[List[float]]], List[List[List[List[float]]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
List[float]
List[List[float]]
List[List[List[float]]]
List[List[List[List[float]]]]
type: Literal["Point", "LineString", "Polygon", 3 more]
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
mode: Optional[Literal["auto", "foot", "bicycle"]]
One of the following:
"auto"
"foot"
"bicycle"
ReturnsExpand Collapse
class RouteResult:
geometry: GeoJsonGeometry
coordinates: Union[List[float], List[List[float]], List[List[List[float]]], List[List[List[List[float]]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
List[float]
List[List[float]]
List[List[List[float]]]
List[List[List[List[float]]]]
type: Literal["Point", "LineString", "Polygon", 3 more]
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Properties
distance: Optional[float]

Total distance in meters

duration: Optional[float]

Estimated duration in seconds

mode: Optional[str]

Travel mode used

type: Literal["Feature"]

Calculate a route between two 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
)
route_result = client.routing.route(
    destination={
        "coordinates": [0],
        "type": "Point",
    },
    origin={
        "coordinates": [0],
        "type": "Point",
    },
)
print(route_result.geometry)
Returns Examples