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

Guidance

The guidance parameter adds turn-by-turn instructions to route responses. When specified, the calculated route includes detailed maneuvers, road names, road shields and distances.

Basic usage

Request guidance instructions. 'coded' is the only instruction format:

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

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

Road shield references

Every guidance response includes references to road shield images, which can be fetched from the TomTom Road Shield API: roadShieldReferences and signpostRoadShieldReferences on each instruction, and the roadShieldAtlasReference they resolve against.

Accessing guidance data

Route instructions are included in the response properties:

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

// Access guidance instructions
const instructions = route.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);
    console.log(instruction.nextRoadInfo.streetName?.text);
});

API reference

For complete documentation of all route guidance properties and types, see the GuidanceParams API Reference.

Related guides and examples

Related guides

Related examples