This is the documentation of version 0.57.0. Go to the latest version, 1.0.0-rc.5.

What the routing SDK adds

The routing services, the map modules and the core types are one surface: every response is GeoJSON that the next call and the map take unchanged. This is what that buys you.

What you get

One function, two endpoints

calculateRoute() serves both the regular routing endpoint and the long-distance EV one, picking between them on whether you passed vehicle.preferences.chargingPreferences.

Fields the API does not return

Field Why it is derived
LegSummary.stopTimeInSeconds The API has no wait-time field. Time at a stop is only visible as the gap between one leg's arrivalDateTime and the next leg's departureDateTime, so it takes the leg pair to see it. Covers a requested wait, EV charging, or both at one stop.
Route versus leg travelTimeInSeconds The route total includes time at stops; per-leg values are driving-only. Comparing the two is how the stops become visible.

Sections, drawn and styled

A route can carry eighteen kinds of section — stretches with a property worth showing: traffic delays, tunnels, ferries, toll roads, low-emission zones, unpaved surfaces, speed limits and more.

const routing = await RoutingModule.create(map, {
  sections: {
    urban: { visible: true },
    lowEmissionZone: { color: '#1B7A43', opacity: 0.8 },
  },
});

Every output is the next call's input

Each step takes the previous step's response as it stands:

const waypoints = await Promise.all(['Munich, DE', 'Verona, IT'].map(geocodeOne));
const routes = await calculateRoute({ locations: waypoints, vehicle: evVehicle });

// The route feature goes straight into the search
const alongRoute = await search({
  poiCategories: ['ELECTRIC_VEHICLE_STATION'],
  route: routes.features[0],
  maxDetourTimeSeconds: 300,
});

// The destination waypoint goes straight into the range
const ranges = await calculateReachableRanges([
  { origin: waypoints.at(-1), budget: { type: 'timeMinutes', value: 20 } },
]);

Where a reachable range goes

A reachable range is a polygon rather than a route, so RoutingModule does not draw it. Pass it to GeometriesModule through prepareReachableRangesForDisplay — see Reachable ranges.

Related guides and examples