Skip to content
GuidesBlogPlaygroundDashboard

Routing

Calculate a route between two points
client.routing.route(RoutingRouteParams { destination, origin, format, 11 more } params, RequestOptionsoptions?): RouteResult { geometry, properties, type }
POST/api/v1/route
Snap a coordinate to the nearest road
client.routing.nearest(RoutingNearestParams { lat, lng, outputFields, 3 more } query, RequestOptionsoptions?): NearestResult { geometry, properties, type }
GET/api/v1/nearest
Snap a coordinate to the nearest road
client.routing.nearestPost(RoutingNearestPostParams { lat, lng, outputFields, 3 more } params, RequestOptionsoptions?): NearestResult { geometry, properties, type }
POST/api/v1/nearest
Calculate an isochrone from a point
client.routing.isochrone(RoutingIsochroneParams { lat, lng, time, 7 more } query, RequestOptionsoptions?): RoutingIsochroneResponse { features, geometry, properties, type }
GET/api/v1/isochrone
Calculate an isochrone from a point
client.routing.isochronePost(RoutingIsochronePostParams { lat, lng, time, 7 more } params, RequestOptionsoptions?): RoutingIsochronePostResponse { features, geometry, properties, type }
POST/api/v1/isochrone
Calculate a distance matrix between points
client.routing.matrix(RoutingMatrixParams { destinations, origins, annotations, 2 more } body, RequestOptionsoptions?): MatrixResult
POST/api/v1/matrix
ModelsExpand Collapse
MatrixRequest { destinations, origins, annotations, 2 more }

Request body for distance matrix calculation. Computes travel durations (and optionally distances) between every origin-destination pair. Maximum 2,500 pairs (origins × destinations), each list capped at 50 coordinates.

destinations: Array<Destination>

Array of destination coordinates (max 50)

lat: number

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: number

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
origins: Array<Origin>

Array of origin coordinates (max 50)

lat: number

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: number

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
annotations?: string

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

fallback_speed?: number | null

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

exclusiveMinimum
minimum0
mode?: "auto" | "foot" | "bicycle"

Travel mode (default: auto)

One of the following:
"auto"
"foot"
"bicycle"
MatrixResult = Record<string, unknown>

Distance matrix result. The exact response shape depends on the routing backend. Contains duration (and optionally distance) data for all origin-destination pairs. Null values indicate unreachable pairs.

NearestResult { geometry, properties, type }

GeoJSON Point Feature representing the nearest point on the road network to the input coordinate. Used for snapping GPS coordinates to roads.

geometry: GeoJsonGeometry { coordinates, type }

GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints.

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

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more

Geometry type

One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Properties { distance_m, edge_id, edge_length_m, 3 more }

Snap result metadata

distance_m?: number

Distance from the input coordinate to the snapped point in meters

edge_id?: number

ID of the road network edge that was snapped to

edge_length_m?: number

Length of the matched road edge in meters

highway?: string | null

OSM highway tag value (e.g. residential, primary, motorway)

osm_way_id?: number

OSM way ID of the matched road segment

surface?: string | null

OSM surface tag value (e.g. asphalt, gravel, paved)

type: "Feature"
RouteRequest { destination, origin, alternatives, 10 more }

Request body for route calculation. Origin and destination are lat/lng coordinate objects. Supports optional waypoints, alternative routes, turn-by-turn steps, and EV routing parameters.

destination: Destination { lat, lng }

Geographic coordinate as a JSON object with lat and lng fields.

lat: number

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: number

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
origin: Origin { lat, lng }

Geographic coordinate as a JSON object with lat and lng fields.

lat: number

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: number

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
alternatives?: number

Number of alternative routes to return (0-3, default 0). When > 0, response is a FeatureCollection of route Features.

maximum3
minimum0
annotations?: boolean

Include per-edge annotations (speed, duration) on the route (default: false)

depart_at?: string | null

Departure time for traffic-aware routing (ISO 8601)

formatdate-time
ev?: Ev | null

Electric vehicle parameters for EV-aware routing

battery_capacity_wh: number

Total battery capacity in watt-hours (required for EV routing)

connector_types?: Array<string> | null

Acceptable connector types (e.g. ["ccs", "chademo"])

initial_charge_pct?: number

Starting charge as a fraction 0-1 (default: 0.8)

maximum1
minimum0
min_charge_pct?: number

Minimum acceptable charge at destination as a fraction 0-1 (default: 0.10)

maximum1
minimum0
min_power_kw?: number | null

Minimum charger power in kilowatts

exclude?: string | null

Comma-separated road types to exclude (e.g. toll,motorway,ferry)

geometries?: "geojson" | "polyline" | "polyline6"

Geometry encoding format. Default: geojson.

One of the following:
"geojson"
"polyline"
"polyline6"
mode?: "auto" | "foot" | "bicycle"

Travel mode (default: auto)

One of the following:
"auto"
"foot"
"bicycle"
overview?: "full" | "simplified" | "false"

Level of geometry detail: full (all points), simplified (Douglas-Peucker), false (no geometry). Default: full.

One of the following:
"full"
"simplified"
"false"
steps?: boolean

Include turn-by-turn navigation steps (default: false)

traffic_model?: "best_guess" | "optimistic" | "pessimistic" | null

Traffic prediction model (only used when depart_at is set)

One of the following:
"best_guess"
"optimistic"
"pessimistic"
waypoints?: Array<Waypoint> | null

Intermediate waypoints to visit in order (maximum 25)

lat: number

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: number

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
RouteResult { geometry, properties, type }

GeoJSON Feature representing a calculated route. The geometry is a LineString or MultiLineString of the route path. When alternatives > 0, the response is a FeatureCollection containing multiple route Features.

geometry: GeoJsonGeometry { coordinates, type }

GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints.

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

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more

Geometry type

One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Properties { distance_m, duration_s, annotations, 4 more }

Route metadata

distance_m: number

Total route distance in meters

duration_s: number

Estimated travel duration in seconds

annotations?: Record<string, unknown> | null

Per-edge annotations (present when annotations: true in request)

charge_profile?: Array<Array<number>> | null

Battery charge level at route waypoints as [distance_fraction, charge_pct] pairs (EV routes only)

charging_stops?: Array<Record<string, unknown>> | null

Recommended charging stops along the route (EV routes only)

edges?: Array<Record<string, unknown>> | null

Edge-level route details (present when annotations: true)

energy_used_wh?: number | null

Total energy consumed in watt-hours (EV routes only)

type: "Feature"