This is the documentation of version 1.0.0-rc.2. 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 work as one. Every response is GeoJSON that the next call and the map take unchanged.

What you get

Fields the API does not return

Field How the SDK derives it
LegSummary.stopTimeInSeconds The API has no wait-time field. Time at a stop is the gap between one leg's arrival and the next leg's departure.
Route versus leg travelTimeInSeconds The route total includes time at stops, while per-leg values are driving only. The difference is the time standing still.
Instruction.pathPointIndex Each maneuver point matched to its index in the route geometry.
originalWaypointIndex on each leg Maps a leg back to the requested location it ends at, when a path location has expanded into legs of its own.
countryCodeISO3 on country and vignette sections, countryCode on instructions Converted from the API's ISO 2 codes.
categories on traffic sections Read from the incident's TPEG2-TEC cause codes, or from its icon category when it has none.

Sections, drawn and styled

A route carries sections, the stretches with a property worth showing, such as traffic delays, tunnels, ferries, toll roads, low-emission zones, unpaved surfaces and speed limits. The route object lists every type.

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 unchanged:

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

// The route feature goes straight into the search
const alongRoute = await discoverPlaces({
  filters: { poiCategories: ['CHARGING_LOCATION'] },
  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, not a route, so RoutingModule doesn't draw it. The reachable ranges module does. It titles each band from its budget and nests each origin's bands.

Related guides and examples