This is the documentation of version 0.64.0. 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.

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 the references: roadShieldReferences for the instruction, signpostRoadShieldReferences for its signpost, and roadShieldAtlasReference, the base URL they resolve against.

API reference

Related guides and examples

Related guides

Related examples