Closed sreenadhkondru closed 7 years ago
Hi! Thanks for reporting this.
Sadly, I'm not actively using this plugin, or GraphHopper for that matter, so I really don't have any idea what the problem might be, and don't really have the time to look into it.
I'd be happy to merge a PR for this, or assist if you want to look into this yourself.
Fixed by #20.
For me, it's not working with the latest version on the repo (it tells me that ReferenceError: require is not defined
as mentioned in another issue).
So I took some time and while preserving the whole content of the latest public release, I just change the content of the _convertInstructions
method with this (coming from the current code):
_convertInstructions: function (instructions) {
var signToType = {
'-7': 'SlightLeft',
'-3': 'SharpLeft',
'-2': 'Left',
'-1': 'SlightLeft',
0: 'Straight',
1: 'SlightRight',
2: 'Right',
3: 'SharpRight',
4: 'DestinationReached',
5: 'WaypointReached',
6: 'Roundabout',
7: 'SlightRight'
},
result = [],
type,
i,
instr;
for (i = 0; instructions && i < instructions.length; i++) {
instr = instructions[i];
if (i === 0) {
type = 'Head';
} else {
type = signToType[instr.sign];
}
result.push({
type: type,
modifier: type,
text: instr.text,
distance: instr.distance,
time: instr.time / 1000,
index: instr.interval[0],
exit: instr.exit_number
});
}
return result
}
This works like a charm, and the most important issues are fixed (the require problem and the turn icons not showing properly).
Hope it helps to someone!
The turn icons are always showing as "go forward". The text is currect and showing as turn left, turn right etc.. Also noticed that this issue is only with the grasshopper plugin. Using the default OSRM the icons are fine.