Skip to content
GuidesBlogPlaygroundDashboard

Routing

Calculate a route between two points
routing().route(RoutingRouteParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : RouteResult
POST/api/v1/route
Snap a coordinate to the nearest road
routing().nearest(RoutingNearestParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : NearestResult
GET/api/v1/nearest
Snap a coordinate to the nearest road
routing().nearestPost(RoutingNearestPostParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : NearestResult
POST/api/v1/nearest
Calculate an isochrone from a point
routing().isochrone(RoutingIsochroneParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : RoutingIsochroneResponse
GET/api/v1/isochrone
Calculate an isochrone from a point
routing().isochronePost(RoutingIsochronePostParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : RoutingIsochronePostResponse
POST/api/v1/isochrone
Calculate a distance matrix between points
routing().matrix(RoutingMatrixParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : MatrixResult
POST/api/v1/matrix
ModelsExpand Collapse
class MatrixRequest:

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: List<Destination>

Array of destination coordinates (max 50)

lat: Double

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: Double

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
origins: List<Origin>

Array of origin coordinates (max 50)

lat: Double

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: Double

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
annotations: Optional<String>

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

fallbackSpeed: Optional<Double>

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<Mode>

Travel mode (default: auto)

One of the following:
AUTO("auto")
FOOT("foot")
BICYCLE("bicycle")
class MatrixResult:

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.

class NearestResult:

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

geometry: GeoJsonGeometry

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

coordinates: Coordinates

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

One of the following:
List<Double>
List<List<Double>>
List<List<List<Double>>>
List<List<List<List<Double>>>>
type: Type

Geometry type

One of the following:
POINT("Point")
LINE_STRING("LineString")
POLYGON("Polygon")
MULTI_POINT("MultiPoint")
MULTI_LINE_STRING("MultiLineString")
MULTI_POLYGON("MultiPolygon")
properties: Properties

Snap result metadata

distanceM: Optional<Double>

Distance from the input coordinate to the snapped point in meters

edgeId: Optional<Long>

ID of the road network edge that was snapped to

edgeLengthM: Optional<Double>

Length of the matched road edge in meters

highway: Optional<String>

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

osmWayId: Optional<Long>

OSM way ID of the matched road segment

surface: Optional<String>

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

type: Type
class RouteRequest:

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

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

lat: Double

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: Double

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
origin: Origin

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

lat: Double

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: Double

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
alternatives: Optional<Long>

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

maximum3
minimum0
annotations: Optional<Boolean>

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

departAt: Optional<LocalDateTime>

Departure time for traffic-aware routing (ISO 8601)

formatdate-time
ev: Optional<Ev>

Electric vehicle parameters for EV-aware routing

batteryCapacityWh: Double

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

connectorTypes: Optional<List<String>>

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

initialChargePct: Optional<Double>

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

maximum1
minimum0
minChargePct: Optional<Double>

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

maximum1
minimum0
minPowerKw: Optional<Double>

Minimum charger power in kilowatts

exclude: Optional<String>

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

geometries: Optional<Geometries>

Geometry encoding format. Default: geojson.

One of the following:
GEOJSON("geojson")
POLYLINE("polyline")
POLYLINE6("polyline6")
mode: Optional<Mode>

Travel mode (default: auto)

One of the following:
AUTO("auto")
FOOT("foot")
BICYCLE("bicycle")
overview: Optional<Overview>

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

One of the following:
FULL("full")
SIMPLIFIED("simplified")
FALSE("false")
steps: Optional<Boolean>

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

trafficModel: Optional<TrafficModel>

Traffic prediction model (only used when depart_at is set)

One of the following:
BEST_GUESS("best_guess")
OPTIMISTIC("optimistic")
PESSIMISTIC("pessimistic")
waypoints: Optional<List<Waypoint>>

Intermediate waypoints to visit in order (maximum 25)

lat: Double

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
lng: Double

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
class RouteResult:

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

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

coordinates: Coordinates

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

One of the following:
List<Double>
List<List<Double>>
List<List<List<Double>>>
List<List<List<List<Double>>>>
type: Type

Geometry type

One of the following:
POINT("Point")
LINE_STRING("LineString")
POLYGON("Polygon")
MULTI_POINT("MultiPoint")
MULTI_LINE_STRING("MultiLineString")
MULTI_POLYGON("MultiPolygon")
properties: Properties

Route metadata

distanceM: Double

Total route distance in meters

durationS: Double

Estimated travel duration in seconds

annotations: Optional<Annotations>

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

chargeProfile: Optional<List<List<Double>>>

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

chargingStops: Optional<List<ChargingStop>>

Recommended charging stops along the route (EV routes only)

edges: Optional<List<Edge>>

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

energyUsedWh: Optional<Double>

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

type: Type