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:
@@ -414,21 +414,21 @@ Feature: Turn Lane Guidance
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | turn:lanes:forward | name |
|
||||
| ab | through\|right\|right\|right | top |
|
||||
| be | | top |
|
||||
| bq | | off |
|
||||
| ef | left\|through\|through\|through\|through\|right | main |
|
||||
| fg | left\|left\|right\|right | main |
|
||||
| fs | | off |
|
||||
| ft | | off |
|
||||
| gh | | top |
|
||||
| hi | | top |
|
||||
| cd | left\|left\|left\|through | bot |
|
||||
| de | | bot |
|
||||
| dr | | off |
|
||||
| gj | | bot |
|
||||
| jk | | bot |
|
||||
| nodes | turn:lanes:forward | name | highway | oneway |
|
||||
| ab | through\|right\|right\|right | top | primary | yes |
|
||||
| be | | top | primary | yes |
|
||||
| bq | | off | primary | yes |
|
||||
| ef | left\|through\|through\|through\|through\|right | main | primary | yes |
|
||||
| fg | left\|left\|right\|right | main | primary | yes |
|
||||
| fs | | off | primary | yes |
|
||||
| ft | | off | primary | yes |
|
||||
| gh | | top | primary | yes |
|
||||
| hi | | top | primary | yes |
|
||||
| cd | left\|left\|left\|through | bot | primary | yes |
|
||||
| de | | bot | primary | yes |
|
||||
| dr | | off | primary | yes |
|
||||
| gj | | bot | primary | yes |
|
||||
| jk | | bot | primary | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | lanes |
|
||||
|
||||
@@ -19,8 +19,8 @@ Feature: Collapse
|
||||
| nodes | highway | name | oneway |
|
||||
| abc | primary | road | yes |
|
||||
| defg | primary | road | yes |
|
||||
| fb | primary_link | | |
|
||||
| be | primary_link | | |
|
||||
| fb | primary_link | | yes |
|
||||
| be | primary_link | | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
|
||||
@@ -888,18 +888,18 @@ Feature: Collapse
|
||||
|
||||
And the ways
|
||||
| nodes | highway | route | name | oneway |
|
||||
| bf | primary | | road | yes |
|
||||
| abf | primary | | road | yes |
|
||||
| hcd | primary | | road | yes |
|
||||
| bc | primary | | | yes |
|
||||
| di | service | | serv | yes |
|
||||
| ed | | ferry | ferry | |
|
||||
| gab | | ferry | ferry | |
|
||||
| ga | | ferry | ferry | |
|
||||
| kg | primary | | on | yes |
|
||||
| ej | primary | | off | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| k,j | on,ferry,,ferry,off,off | depart,notification straight,continue uturn,turn straight,notification straight,arrive |
|
||||
| waypoints | route | turns |
|
||||
| k,j | on,ferry,road,road,ferry,off,off | depart,notification straight,notification straight,continue uturn,turn straight,notification straight,arrive |
|
||||
|
||||
# http://www.openstreetmap.org/#map=19/37.78090/-122.41251
|
||||
Scenario: U-Turn onto unnamed-road
|
||||
@@ -922,5 +922,84 @@ Feature: Collapse
|
||||
| ef | secondary | | down | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,1 | up,turn,down, | depart,turn right,turn right,arrive |
|
||||
| waypoints | route | turns |
|
||||
| a,1 | up,turn,, | depart,turn right,turn sharp right,arrive |
|
||||
|
||||
#http://www.openstreetmap.org/#map=19/52.48778/13.30024
|
||||
Scenario: Hohenzollerdammbrücke
|
||||
Given the node map
|
||||
"""
|
||||
q s
|
||||
p o
|
||||
.. . .
|
||||
. . . .
|
||||
j - i - - - h - - - g - f
|
||||
> k < > l <
|
||||
a - b - - - c - - - d - e
|
||||
. . . .
|
||||
.. ..
|
||||
m n
|
||||
t r
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | name | oneway |
|
||||
| ab | secondary | hohe | yes |
|
||||
| bc | secondary | hohebruecke | yes |
|
||||
| cd | secondary | hohebruecke | yes |
|
||||
| bk | secondary | hohebruecke | yes |
|
||||
| kh | secondary | hohebruecke | yes |
|
||||
| ki | secondary | hohebruecke | yes |
|
||||
| ck | secondary | hohebruecke | yes |
|
||||
| de | secondary | hohe | yes |
|
||||
| fg | secondary | hohe | yes |
|
||||
| gh | secondary | hohebruecke | yes |
|
||||
| hi | secondary | hohebruecke | yes |
|
||||
| gl | secondary | hohebruecke | yes |
|
||||
| lc | secondary | hohebruecke | yes |
|
||||
| hl | secondary | hohebruecke | yes |
|
||||
| ld | secondary | hohebruecke | yes |
|
||||
| ij | secondary | hohe | yes |
|
||||
| bm | motorway_link | a100 | yes |
|
||||
| cm | motorway_link | a100 | yes |
|
||||
| nc | motorway_link | a100 | yes |
|
||||
| nd | motorway_link | a100 | yes |
|
||||
| go | motorway_link | a100 | yes |
|
||||
| ho | motorway_link | a100 | yes |
|
||||
| ph | motorway_link | a100 | yes |
|
||||
| pi | motorway_link | a100 | yes |
|
||||
| qp | motorway_link | a100 | yes |
|
||||
| mt | motorway_link | a100 | yes |
|
||||
| rn | motorway_link | a100 | yes |
|
||||
| os | motorway_link | a100 | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | ck | kh | k | no_right_turn |
|
||||
| restriction | bk | ki | k | no_left_turn |
|
||||
| restriction | hl | lc | l | no_right_turn |
|
||||
| restriction | gl | ld | l | no_left_turn |
|
||||
| restriction | bc | cm | c | no_right_turn |
|
||||
| restriction | bc | ck | c | no_left_turn |
|
||||
| restriction | nc | cm | c | no_left_turn |
|
||||
| restriction | nc | cd | c | no_right_turn |
|
||||
| restriction | lc | ck | c | no_left_turn |
|
||||
| restriction | lc | cd | c | no_right_turn |
|
||||
| restriction | gh | ho | h | no_right_turn |
|
||||
| restriction | gh | hl | h | no_left_turn |
|
||||
| restriction | kh | hi | h | no_left_turn |
|
||||
| restriction | kh | hl | h | no_right_turn |
|
||||
| restriction | ph | ho | h | no_left_turn |
|
||||
| restriction | ph | hi | h | no_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,e | hohe,hohe | depart,arrive |
|
||||
| a,s | hohe,a100,a100 | depart,on ramp left,arrive |
|
||||
| a,t | hohe,a100,a100 | depart,on ramp right,arrive |
|
||||
| a,j | | |
|
||||
| f,j | hohe,hohe | depart,arrive |
|
||||
| a,t | hohe,a100,a100 | depart,on ramp right,arrive |
|
||||
| f,e | | |
|
||||
| q,j | a100,hohe,hohe | depart,turn right,arrive |
|
||||
| q,e | a100,a100,hohe | depart,continue left,arrive |
|
||||
|
||||
@@ -134,4 +134,5 @@ Feature: Continue Instructions
|
||||
| a,c | abcdefb,abcdefb,abcdefb | depart,continue right,arrive |
|
||||
| a,f | abcdefb,abcdefb,abcdefb | depart,continue left,arrive |
|
||||
| a,d | abcdefb,abcdefb,abcdefb | depart,continue right,arrive |
|
||||
| a,e | abcdefb,abcdefb,abcdefb | depart,continue left,arrive |
|
||||
# continuing right here, since the turn to the left is more expensive
|
||||
| a,e | abcdefb,abcdefb,abcdefb | depart,continue right,arrive |
|
||||
|
||||
@@ -43,6 +43,10 @@ Feature: Slipways and Dedicated Turn Lanes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
f
|
||||
|
||||
|
||||
@@ -59,6 +63,31 @@ Feature: Slipways and Dedicated Turn Lanes
|
||||
| waypoints | route | turns |
|
||||
| a,g | first,,second,second | depart,off ramp slight right,turn straight,arrive |
|
||||
|
||||
Scenario: Turn Instead of Ramp
|
||||
Given the node map
|
||||
"""
|
||||
e
|
||||
a b c d
|
||||
h
|
||||
|
||||
|
||||
|
||||
f
|
||||
|
||||
|
||||
g
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | name |
|
||||
| abcd | motorway | first |
|
||||
| bhf | motorway_link | |
|
||||
| efg | primary | second |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,g | first,,second,second | depart,off ramp slight right,turn straight,arrive |
|
||||
|
||||
Scenario: Inner city expressway with on road
|
||||
Given the node map
|
||||
"""
|
||||
@@ -208,11 +237,11 @@ Feature: Slipways and Dedicated Turn Lanes
|
||||
| jcghf | primary | Brauerstrasse | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,i | Ebertstrasse,Ebertstrasse | depart,arrive |
|
||||
| a,l | Ebertstrasse,Ebertstrasse | depart,arrive |
|
||||
| a,f | Ebertstrasse,Brauerstrasse,Brauerstrasse | depart,turn right,arrive |
|
||||
| a,1 | Ebertstrasse,, | depart,turn slight right,arrive |
|
||||
| waypoints | route | turns |
|
||||
| a,i | Ebertstrasse,Ebertstrasse | depart,arrive |
|
||||
| a,l | Ebertstrasse,Ebertstrasse | depart,arrive |
|
||||
| a,f | Ebertstrasse,Brauerstrasse,Brauerstrasse | depart,turn right,arrive |
|
||||
| a,1 | Ebertstrasse,, | depart,turn right,arrive |
|
||||
|
||||
#2839
|
||||
Scenario: Self-Loop
|
||||
|
||||
@@ -435,9 +435,9 @@ Feature: Basic Roundabout
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | bearing |
|
||||
| a,d | ab,cd,cd | depart,roundabout turn left exit-3,arrive | 0->180,180->224,90->0 |
|
||||
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive | 0->180,180->224,180->0 |
|
||||
| a,h | ab,gh,gh | depart,roundabout turn right exit-1,arrive | 0->180,180->224,270->0 |
|
||||
| a,d | ab,cd,cd | depart,roundabout turn left exit-3,arrive | 0->180,180->225,90->0 |
|
||||
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive | 0->180,180->225,180->0 |
|
||||
| a,h | ab,gh,gh | depart,roundabout turn right exit-1,arrive | 0->180,180->225,270->0 |
|
||||
|
||||
Scenario: Enter and Exit - Bearings
|
||||
Given the node map
|
||||
|
||||
@@ -377,8 +377,8 @@ Feature: Basic Roundabout
|
||||
| h | give_way |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| waypoints | route | turns |
|
||||
# since we cannot handle these invalid roundabout tags yet, we cannout output roundabout taggings. This will hopefully change some day
|
||||
#| w,x | ll,egg,egg,tr,tr | depart,roundabout-exit-1,roundabout-exit-2,arrive |
|
||||
| w,x | ll,egg,egg,tr,tr | depart,turn right,continue left,turn slight left,arrive |
|
||||
| w,x | ll,egg,egg,tr,tr | depart,turn right,continue left,turn straight,arrive |
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -901,10 +901,10 @@ Feature: Turn Lane Guidance
|
||||
Given the node map
|
||||
"""
|
||||
f e
|
||||
|
||||
|
||||
c
|
||||
a b
|
||||
| |
|
||||
| |
|
||||
| c
|
||||
a - b ' |
|
||||
g d
|
||||
"""
|
||||
|
||||
@@ -1091,3 +1091,26 @@ Feature: Turn Lane Guidance
|
||||
| waypoints | route | turns | lanes |
|
||||
| a,f | ,ksd,ksd | depart,turn left,arrive | ,left:true none:true right:false, |
|
||||
| a,i | ,ksd,ksd | depart,turn right,arrive | ,left:false none:true right:true, |
|
||||
|
||||
Scenario: Reverse Not Allowed
|
||||
Given the node map
|
||||
"""
|
||||
n o
|
||||
f - - e\- - g-j-m
|
||||
d | |
|
||||
a - 1 b/- - c-i-l
|
||||
h k
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | highway | oneway | turn:lanes:forward |
|
||||
| abc | road | secondary | yes | left\|through\|right |
|
||||
| cil | road | secondary | yes | |
|
||||
| mjgef | road | secondary | yes | |
|
||||
| bde | road | secondary_link | yes | |
|
||||
| ngch | turn | secondary | yes | |
|
||||
| kijo | turn | secondary | yes | |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | bearings | route | turns |
|
||||
| 1,a | 90,2 180,180 | | |
|
||||
|
||||
@@ -827,16 +827,16 @@ Feature: Simple Turns
|
||||
|
||||
And the ways
|
||||
| nodes | highway | oneway |
|
||||
| abc | primary | no |
|
||||
| db | primary | no |
|
||||
| abc | primary | yes |
|
||||
| bd | primary | yes |
|
||||
| eb | primary | yes |
|
||||
| fb | primary | no |
|
||||
| bg | primary | no |
|
||||
| bf | primary | yes |
|
||||
| bg | primary | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,d | abc,db,db | depart,turn sharp right,arrive |
|
||||
| a,f | abc,fb,fb | depart,turn right,arrive |
|
||||
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
|
||||
| a,f | abc,bf,bf | depart,turn right,arrive |
|
||||
|
||||
Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 3
|
||||
Given the node map
|
||||
@@ -907,11 +907,10 @@ Feature: Simple Turns
|
||||
Scenario: Turn Lane on Splitting up Road
|
||||
Given the node map
|
||||
"""
|
||||
|
||||
g f
|
||||
|
||||
h e c d
|
||||
a b
|
||||
g - - - f
|
||||
\
|
||||
. h - - e - - c - - d
|
||||
a - - b _______/
|
||||
i
|
||||
"""
|
||||
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user