Calculate a route between two points
routing.route(RoutingRouteParams**kwargs) -> RouteResult
POST/api/v1/route
Calculate a route between two points
Parameters
alternatives: Optional[int]
Number of alternative routes to return (0-3, default 0). When > 0, response is a FeatureCollection of route Features.
maximum3
minimum0
depart_at: Optional[Union[str, datetime, null]]
Departure time for traffic-aware routing (ISO 8601)
formatdate-time
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={
"lat": 48.8584,
"lng": 2.2945,
},
origin={
"lat": 48.8566,
"lng": 2.3522,
},
)
print(route_result.geometry){
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"distance_m": 4523.7,
"duration_s": 847.2,
"annotations": {
"foo": "bar"
},
"charge_profile": [
[
0
]
],
"charging_stops": [
{
"foo": "bar"
}
],
"edges": [
{
"foo": "bar"
}
],
"energy_used_wh": 0
},
"type": "Feature"
}Returns Examples
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"distance_m": 4523.7,
"duration_s": 847.2,
"annotations": {
"foo": "bar"
},
"charge_profile": [
[
0
]
],
"charging_stops": [
{
"foo": "bar"
}
],
"edges": [
{
"foo": "bar"
}
],
"energy_used_wh": 0
},
"type": "Feature"
}