Skip to content

Commit 5333017

Browse files
author
Moritz Kobitzsch
committed
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.
1 parent 6cf99c8 commit 5333017

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3295
-626
lines changed

features/guidance/anticipate-lanes.feature

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -414,21 +414,21 @@ Feature: Turn Lane Guidance
414414
"""
415415

416416
And the ways
417-
| nodes | turn:lanes:forward | name |
418-
| ab | through\|right\|right\|right | top |
419-
| be | | top |
420-
| bq | | off |
421-
| ef | left\|through\|through\|through\|through\|right | main |
422-
| fg | left\|left\|right\|right | main |
423-
| fs | | off |
424-
| ft | | off |
425-
| gh | | top |
426-
| hi | | top |
427-
| cd | left\|left\|left\|through | bot |
428-
| de | | bot |
429-
| dr | | off |
430-
| gj | | bot |
431-
| jk | | bot |
417+
| nodes | turn:lanes:forward | name | highway | oneway |
418+
| ab | through\|right\|right\|right | top | primary | yes |
419+
| be | | top | primary | yes |
420+
| bq | | off | primary | yes |
421+
| ef | left\|through\|through\|through\|through\|right | main | primary | yes |
422+
| fg | left\|left\|right\|right | main | primary | yes |
423+
| fs | | off | primary | yes |
424+
| ft | | off | primary | yes |
425+
| gh | | top | primary | yes |
426+
| hi | | top | primary | yes |
427+
| cd | left\|left\|left\|through | bot | primary | yes |
428+
| de | | bot | primary | yes |
429+
| dr | | off | primary | yes |
430+
| gj | | bot | primary | yes |
431+
| jk | | bot | primary | yes |
432432

433433
When I route I should get
434434
| waypoints | route | turns | lanes |

features/guidance/collapse-detail.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Feature: Collapse
1919
| nodes | highway | name | oneway |
2020
| abc | primary | road | yes |
2121
| defg | primary | road | yes |
22-
| fb | primary_link | | |
23-
| be | primary_link | | |
22+
| fb | primary_link | | yes |
23+
| be | primary_link | | yes |
2424

2525
When I route I should get
2626
| waypoints | route | turns |

features/guidance/collapse.feature

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,15 +888,94 @@ Feature: Collapse
888888

889889
And the ways
890890
| nodes | highway | route | name | oneway |
891-
| bf | primary | | road | yes |
891+
| abf | primary | | road | yes |
892892
| hcd | primary | | road | yes |
893893
| bc | primary | | | yes |
894894
| di | service | | serv | yes |
895895
| ed | | ferry | ferry | |
896-
| gab | | ferry | ferry | |
896+
| ga | | ferry | ferry | |
897897
| kg | primary | | on | yes |
898898
| ej | primary | | off | yes |
899899

900900
When I route I should get
901-
| waypoints | route | turns |
902-
| k,j | on,ferry,,ferry,off,off | depart,notification straight,continue uturn,turn straight,notification straight,arrive |
901+
| waypoints | route | turns |
902+
| k,j | on,ferry,road,road,ferry,off,off | depart,notification straight,notification straight,continue uturn,turn straight,notification straight,arrive |
903+
904+
#http://www.openstreetmap.org/#map=19/52.48778/13.30024
905+
Scenario: Hohenzollerdammbrücke
906+
Given the node map
907+
"""
908+
q s
909+
p o
910+
.. . .
911+
. . . .
912+
j - i - - - h - - - g - f
913+
> k < > l <
914+
a - b - - - c - - - d - e
915+
. . . .
916+
.. ..
917+
m n
918+
t r
919+
"""
920+
921+
And the ways
922+
| nodes | highway | name | oneway |
923+
| ab | secondary | hohe | yes |
924+
| bc | secondary | hohebruecke | yes |
925+
| cd | secondary | hohebruecke | yes |
926+
| bk | secondary | hohebruecke | yes |
927+
| kh | secondary | hohebruecke | yes |
928+
| ki | secondary | hohebruecke | yes |
929+
| ck | secondary | hohebruecke | yes |
930+
| de | secondary | hohe | yes |
931+
| fg | secondary | hohe | yes |
932+
| gh | secondary | hohebruecke | yes |
933+
| hi | secondary | hohebruecke | yes |
934+
| gl | secondary | hohebruecke | yes |
935+
| lc | secondary | hohebruecke | yes |
936+
| hl | secondary | hohebruecke | yes |
937+
| ld | secondary | hohebruecke | yes |
938+
| ij | secondary | hohe | yes |
939+
| bm | motorway_link | a100 | yes |
940+
| cm | motorway_link | a100 | yes |
941+
| nc | motorway_link | a100 | yes |
942+
| nd | motorway_link | a100 | yes |
943+
| go | motorway_link | a100 | yes |
944+
| ho | motorway_link | a100 | yes |
945+
| ph | motorway_link | a100 | yes |
946+
| pi | motorway_link | a100 | yes |
947+
| qp | motorway_link | a100 | yes |
948+
| mt | motorway_link | a100 | yes |
949+
| rn | motorway_link | a100 | yes |
950+
| os | motorway_link | a100 | yes |
951+
952+
And the relations
953+
| type | way:from | way:to | node:via | restriction |
954+
| restriction | ck | kh | k | no_right_turn |
955+
| restriction | bk | ki | k | no_left_turn |
956+
| restriction | hl | lc | l | no_right_turn |
957+
| restriction | gl | ld | l | no_left_turn |
958+
| restriction | bc | cm | c | no_right_turn |
959+
| restriction | bc | ck | c | no_left_turn |
960+
| restriction | nc | cm | c | no_left_turn |
961+
| restriction | nc | cd | c | no_right_turn |
962+
| restriction | lc | ck | c | no_left_turn |
963+
| restriction | lc | cd | c | no_right_turn |
964+
| restriction | gh | ho | h | no_right_turn |
965+
| restriction | gh | hl | h | no_left_turn |
966+
| restriction | kh | hi | h | no_left_turn |
967+
| restriction | kh | hl | h | no_right_turn |
968+
| restriction | ph | ho | h | no_left_turn |
969+
| restriction | ph | hi | h | no_right_turn |
970+
971+
When I route I should get
972+
| waypoints | route | turns |
973+
| a,e | hohe,hohe | depart,arrive |
974+
| a,s | hohe,a100,a100 | depart,on ramp left,arrive |
975+
| a,t | hohe,a100,a100 | depart,on ramp right,arrive |
976+
| a,j | | |
977+
| f,j | hohe,hohe | depart,arrive |
978+
| a,t | hohe,a100,a100 | depart,on ramp right,arrive |
979+
| f,e | | |
980+
| q,j | a100,hohe,hohe | depart,turn right,arrive |
981+
| q,e | a100,a100,hohe | depart,continue left,arrive |

features/guidance/continue.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,5 @@ Feature: Continue Instructions
134134
| a,c | abcdefb,abcdefb,abcdefb | depart,continue right,arrive |
135135
| a,f | abcdefb,abcdefb,abcdefb | depart,continue left,arrive |
136136
| a,d | abcdefb,abcdefb,abcdefb | depart,continue right,arrive |
137-
| a,e | abcdefb,abcdefb,abcdefb | depart,continue left,arrive |
137+
# continuing right here, since the turn to the left is more expensive
138+
| a,e | abcdefb,abcdefb,abcdefb | depart,continue right,arrive |

features/guidance/dedicated-turn-roads.feature

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Feature: Slipways and Dedicated Turn Lanes
4343
4444
4545
46+
47+
48+
49+
4650
f
4751
4852
@@ -59,6 +63,31 @@ Feature: Slipways and Dedicated Turn Lanes
5963
| waypoints | route | turns |
6064
| a,g | first,,second,second | depart,off ramp slight right,turn straight,arrive |
6165

66+
Scenario: Turn Instead of Ramp
67+
Given the node map
68+
"""
69+
e
70+
a b c d
71+
h
72+
73+
74+
75+
f
76+
77+
78+
g
79+
"""
80+
81+
And the ways
82+
| nodes | highway | name |
83+
| abcd | motorway | first |
84+
| bhf | motorway_link | |
85+
| efg | primary | second |
86+
87+
When I route I should get
88+
| waypoints | route | turns |
89+
| a,g | first,,second,second | depart,off ramp slight right,turn straight,arrive |
90+
6291
Scenario: Inner city expressway with on road
6392
Given the node map
6493
"""
@@ -208,11 +237,11 @@ Feature: Slipways and Dedicated Turn Lanes
208237
| jcghf | primary | Brauerstrasse | yes |
209238

210239
When I route I should get
211-
| waypoints | route | turns |
212-
| a,i | Ebertstrasse,Ebertstrasse | depart,arrive |
213-
| a,l | Ebertstrasse,Ebertstrasse | depart,arrive |
214-
| a,f | Ebertstrasse,Brauerstrasse,Brauerstrasse | depart,turn right,arrive |
215-
| a,1 | Ebertstrasse,, | depart,turn slight right,arrive |
240+
| waypoints | route | turns |
241+
| a,i | Ebertstrasse,Ebertstrasse | depart,arrive |
242+
| a,l | Ebertstrasse,Ebertstrasse | depart,arrive |
243+
| a,f | Ebertstrasse,Brauerstrasse,Brauerstrasse | depart,turn right,arrive |
244+
| a,1 | Ebertstrasse,, | depart,turn right,arrive |
216245

217246
#2839
218247
Scenario: Self-Loop

features/guidance/roundabout-turn.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ Feature: Basic Roundabout
435435

436436
When I route I should get
437437
| waypoints | route | turns | bearing |
438-
| a,d | ab,cd,cd | depart,roundabout turn left exit-3,arrive | 0->180,180->224,90->0 |
439-
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive | 0->180,180->224,180->0 |
440-
| a,h | ab,gh,gh | depart,roundabout turn right exit-1,arrive | 0->180,180->224,270->0 |
438+
| a,d | ab,cd,cd | depart,roundabout turn left exit-3,arrive | 0->180,180->225,90->0 |
439+
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive | 0->180,180->225,180->0 |
440+
| a,h | ab,gh,gh | depart,roundabout turn right exit-1,arrive | 0->180,180->225,270->0 |
441441

442442
Scenario: Enter and Exit - Bearings
443443
Given the node map

features/guidance/roundabout.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ Feature: Basic Roundabout
377377
| h | give_way |
378378

379379
When I route I should get
380-
| waypoints | route | turns |
380+
| waypoints | route | turns |
381381
# since we cannot handle these invalid roundabout tags yet, we cannout output roundabout taggings. This will hopefully change some day
382382
#| w,x | ll,egg,egg,tr,tr | depart,roundabout-exit-1,roundabout-exit-2,arrive |
383-
| w,x | ll,egg,egg,tr,tr | depart,turn right,continue left,turn slight left,arrive |
383+
| w,x | ll,egg,egg,tr,tr | depart,turn right,continue left,turn straight,arrive |
384384

0 commit comments

Comments
 (0)