Skip to content
GuidesPlaygroundDashboard

Routing

Calculate a route between two points
client.routing.route(RoutingRouteParams { destination, origin, mode } body, RequestOptionsoptions?): RouteResult { geometry, properties, type }
POST/api/v1/route
Snap a coordinate to the nearest road
client.routing.nearest(RoutingNearestParams { lat, lng, radius } query, RequestOptionsoptions?): NearestResult { geometry, properties, type }
GET/api/v1/nearest
Calculate an isochrone from a point
client.routing.isochrone(RoutingIsochroneParams { lat, lng, time, mode } query, RequestOptionsoptions?): GeoJsonFeature { geometry, properties, type, 2 more }
GET/api/v1/isochrone
Calculate a distance matrix between points
client.routing.matrix(RoutingMatrixParams { destinations, origins, mode } body, RequestOptionsoptions?): MatrixResult { distances, durations }
POST/api/v1/matrix
ModelsExpand Collapse
MatrixRequest { destinations, origins, mode }
destinations: GeoJsonGeometry { coordinates, type }

Destination points (GeoJSON MultiPoint geometry)

coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
origins: GeoJsonGeometry { coordinates, type }

Origin points (GeoJSON MultiPoint geometry)

coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
mode?: "auto" | "foot" | "bicycle"

Travel mode

One of the following:
"auto"
"foot"
"bicycle"
MatrixResult { distances, durations }
distances: Array<Array<number | null>>

Distance matrix (meters), origins x destinations

durations: Array<Array<number | null>>

Duration matrix (seconds), origins x destinations

NearestResult { geometry, properties, type }

GeoJSON Point Feature snapped to the nearest road segment

geometry: GeoJsonGeometry { coordinates, type }
coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Properties { distance_m, edge_id }
distance_m?: number

Distance to nearest road in meters

edge_id?: number | null

Road edge ID

type: "Feature"
RouteRequest { destination, origin, mode }
destination: GeoJsonGeometry { coordinates, type }

Destination point (GeoJSON Point geometry)

coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
origin: GeoJsonGeometry { coordinates, type }

Origin point (GeoJSON Point geometry)

coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
mode?: "auto" | "foot" | "bicycle"
One of the following:
"auto"
"foot"
"bicycle"
RouteResult { geometry, properties, type }
geometry: GeoJsonGeometry { coordinates, type }
coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Properties { distance, duration, mode }
distance?: number

Total distance in meters

duration?: number

Estimated duration in seconds

mode?: string

Travel mode used

type: "Feature"