);
// Add each row
- turnByTurnTable.append(route.steps.map(([ll, direction, instruction, dist, lineseg], i) => {
+ turnByTurnTable.append(route.steps.map(([direction, instruction, dist, lineseg], i) => {
const row = $("<tr class='turn'/>");
if (direction) {
row.append("<td class='border-0'><svg width='20' height='20' class='d-block'><use href='#routing-sprite-" + direction + "' /></svg></td>");
row.on("click", function () {
popup
- .setLatLng(ll)
+ .setLatLng(lineseg[0])
.setContent(`<p><b>${i + 1}.</b> ${instruction}</p>`)
.openOn(map);
});
const step_geometry = L.PolylineUtil.decode(step.geometry, { precision: 5 });
const instText = getInstructionText(step, maneuver_id);
return [
- [step.maneuver.location[1], step.maneuver.location[0]],
ICON_MAP[maneuver_id],
instText,
step.distance,
});
return {
- line: steps.flatMap(step => step[4]),
+ line: steps.flatMap(step => step[3]),
steps,
distance: leg.distance,
time: leg.duration
const lineseg = line
.slice(manoeuvre.begin_shape_index, manoeuvre.end_shape_index + 1);
return [
- lineseg[0],
INSTR_MAP[manoeuvre.type],
manoeuvre.instruction,
manoeuvre.length * 1000,
const lineseg = line
.slice(instr.interval[0], instr.interval[1] + 1);
return [
- lineseg[0],
GH_INSTR_MAP[instr.sign],
instr.text,
instr.distance,
lineseg
];
});
- steps.at(-1)[1] = "destination";
+ steps.at(-1)[0] = "destination";
return {
line: line,
return Promise.resolve({
line: points,
steps: [
- [points[0], "start", "<b>1.</b> #{start_instruction}", distance, points],
- [points[1], "destination", "<b>2.</b> #{finish_instruction}", 0, [points[1]]]
+ ["start", "<b>1.</b> #{start_instruction}", distance, points],
+ ["destination", "<b>2.</b> #{finish_instruction}", 0, [points[1]]]
],
distance,
time