Turn Angles in OSRM were computed using a lookahead of 10 meters.

This PR adds more advanced coordinate extraction, analysing the road
to detect offsets due to OSM way modelling.

In addition it improves the handling of bearings. Right now OSM reports
bearings simply based on the very first coordinate along a way.
With this PR, we store the bearings for a turn correctly, making the
bearings for turns correct.
This commit is contained in:
Moritz Kobitzsch
2016-08-17 09:49:19 +02:00
parent 1f8ca2879f
commit 5e167b8745
62 changed files with 3451 additions and 679 deletions
+10 -3
View File
@@ -121,8 +121,7 @@ module.exports = function () {
return this.requestPath('match', params, callback);
};
this.extractInstructionList = (instructions, keyFinder, postfix) => {
postfix = postfix || null;
this.extractInstructionList = (instructions, keyFinder) => {
if (instructions) {
return instructions.legs.reduce((m, v) => m.concat(v.steps), [])
.map(keyFinder)
@@ -152,8 +151,16 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.destinations || '');
};
this.reverseBearing = (bearing) => {
if (bearing >= 180)
return bearing - 180.;
return bearing + 180;
};
this.bearingList = (instructions) => {
return this.extractInstructionList(instructions, s => s.maneuver.bearing_before + '->' + s.maneuver.bearing_after);
return this.extractInstructionList(instructions, s => ('in' in s.intersections[0] ? this.reverseBearing(s.intersections[0].bearings[s.intersections[0].in]) : 0)
+ '->' +
('out' in s.intersections[0] ? s.intersections[0].bearings[s.intersections[0].out] : 0));
};
this.annotationList = (instructions) => {