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

Guidance

guidance adds turn-by-turn instructions to each route: maneuvers, ready-made instruction text, road names, road shields and junction layouts.

The demo below requests guidance for a route through central Amsterdam. The routing module draws an arrow at every turn, and the panel lists each instruction with the lanes to take.

Basic usage

'coded' is the only instruction format:

import { calculateRoute } from '@tomtom-org/maps-sdk/services';

const routes = await calculateRoute({
    locations: [[4.9041, 52.3676], [2.3522, 48.8566]],
    guidance: { type: 'coded' }
});

const instructions = routes.features[0].properties.guidance?.instructions;

What each instruction carries

Name fields (street names, road numbers, signpost exits, intersections, tollgates and countries) are InstructionText objects, carrying the name as text:

instructions?.forEach((instruction) => {
    console.log(instruction.message, instruction.nextRoadInfo.streetName?.text);
});

Road shield references

Road shield images come from the TomTom Road Shield API. Each instruction carries roadShieldReferences for the instruction and signpostRoadShieldReferences for its signpost. roadShieldAtlasReference is the base URL they resolve against.

API reference

Related guides and examples

Related guides

Related examples