The route the instruction belongs to.
One of the route's guidance.instructions.
The lane section, or undefined when the route has none leading to the maneuver.
calculateRoute returns lanes sections only with guidance, and not every maneuver has one.
A section leads to the last instruction inside it or, when it ends at a stop line short of the junction, to the next one after it. Where several lead to one instruction, the closest wins. Instructions sharing a point, such as a roundabout's entry and exit, leave the lanes to the first.
const routes = await calculateRoute({ locations, guidance: { type: 'coded' } });
const route = routes.features[0];
for (const instruction of route.properties.guidance?.instructions ?? []) {
const lanes = getInstructionLanes(route, instruction);
// lanes?.lanes: each lane's directions, and the one to follow
}
Finds the
lanessection leading to an instruction's maneuver.