2012-09-30 08:40:59 -04:00
|
|
|
@routing @bicycle @restrictions
|
2012-10-01 07:27:08 -04:00
|
|
|
Feature: Bike - Turn restrictions
|
2012-02-14 11:21:07 -05:00
|
|
|
Handle turn restrictions as defined by http://wiki.openstreetmap.org/wiki/Relation:restriction
|
2012-03-02 07:35:30 -05:00
|
|
|
Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes.
|
2012-03-05 10:11:11 -05:00
|
|
|
|
|
|
|
Background: Use car routing
|
2012-12-16 07:36:47 -05:00
|
|
|
Given the profile "bicycle"
|
2012-03-05 10:11:11 -05:00
|
|
|
|
|
|
|
@no_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - No left turn
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-05 10:11:11 -05:00
|
|
|
| | n | |
|
|
|
|
| w | j | e |
|
|
|
|
| | s | |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | wj | j | no_left_turn |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
|
|
|
| s | w | |
|
2012-03-05 10:11:11 -05:00
|
|
|
| s | n | sj,nj |
|
|
|
|
| s | e | sj,ej |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
2012-03-05 10:11:11 -05:00
|
|
|
@no_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - No right turn
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-02 07:35:30 -05:00
|
|
|
| | n | |
|
|
|
|
| w | j | e |
|
2012-02-14 11:21:07 -05:00
|
|
|
| | s | |
|
|
|
|
|
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | ej | j | no_right_turn |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
2012-03-05 10:11:11 -05:00
|
|
|
| s | w | sj,wj |
|
2012-03-02 07:35:30 -05:00
|
|
|
| s | n | sj,nj |
|
2012-03-05 10:11:11 -05:00
|
|
|
| s | e | |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
2012-03-05 10:11:11 -05:00
|
|
|
@no_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - No u-turn
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-05 10:11:11 -05:00
|
|
|
| | n | |
|
2012-03-02 07:35:30 -05:00
|
|
|
| w | j | e |
|
2012-02-14 11:21:07 -05:00
|
|
|
| | s | |
|
|
|
|
|
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | wj | j | no_u_turn |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
|
|
|
When I route I should get
|
2012-03-05 10:11:11 -05:00
|
|
|
| from | to | route |
|
|
|
|
| s | w | |
|
|
|
|
| s | n | sj,nj |
|
|
|
|
| s | e | sj,ej |
|
|
|
|
|
|
|
|
@no_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - Handle any no_* relation
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-02 07:35:30 -05:00
|
|
|
| | n | |
|
|
|
|
| w | j | e |
|
|
|
|
| | s | |
|
|
|
|
|
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | wj | j | no_weird_zigzags |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
2012-03-05 10:11:11 -05:00
|
|
|
| s | w | |
|
|
|
|
| s | n | sj,nj |
|
|
|
|
| s | e | sj,ej |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
2012-03-05 10:11:11 -05:00
|
|
|
@only_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - Only left turn
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-02 07:35:30 -05:00
|
|
|
| | n | |
|
|
|
|
| w | j | e |
|
|
|
|
| | s | |
|
|
|
|
|
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | wj | j | only_left_turn |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
2012-11-28 12:42:49 -05:00
|
|
|
| s | w | sj,wj |
|
|
|
|
| s | n | |
|
|
|
|
| s | e | |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
2012-03-05 10:11:11 -05:00
|
|
|
@only_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - Only right turn
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-05 10:11:11 -05:00
|
|
|
| | n | |
|
2012-03-02 07:35:30 -05:00
|
|
|
| w | j | e |
|
|
|
|
| | s | |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | ej | j | only_right_turn |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
|
|
|
When I route I should get
|
2012-03-05 10:11:11 -05:00
|
|
|
| from | to | route |
|
|
|
|
| s | w | |
|
|
|
|
| s | n | |
|
|
|
|
| s | e | sj,ej |
|
|
|
|
|
|
|
|
@only_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - Only straight on
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-02 07:35:30 -05:00
|
|
|
| | n | |
|
|
|
|
| w | j | e |
|
|
|
|
| | s | |
|
2012-02-14 11:21:07 -05:00
|
|
|
|
2012-03-02 07:35:30 -05:00
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | nj | j | only_straight_on |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
|
|
|
| s | w | |
|
2012-03-05 10:11:11 -05:00
|
|
|
| s | n | sj,nj |
|
|
|
|
| s | e | |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
2012-03-05 10:11:11 -05:00
|
|
|
@no_turning
|
2012-10-01 07:27:08 -04:00
|
|
|
Scenario: Bike - Handle any only_* restriction
|
2012-03-08 02:37:41 -05:00
|
|
|
Given the node map
|
2012-03-05 10:11:11 -05:00
|
|
|
| | n | |
|
|
|
|
| w | j | e |
|
|
|
|
| | s | |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
And the ways
|
2012-11-28 12:42:49 -05:00
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| nj | -1 |
|
|
|
|
| wj | -1 |
|
|
|
|
| ej | -1 |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction |
|
|
|
|
| restriction | sj | nj | j | only_weird_zigzags |
|
2012-03-02 07:35:30 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
2012-03-05 10:11:11 -05:00
|
|
|
| s | w | |
|
|
|
|
| s | n | sj,nj |
|
|
|
|
| s | e | |
|
2012-11-28 12:42:49 -05:00
|
|
|
|
2013-01-05 11:35:50 -05:00
|
|
|
@except
|
2012-11-28 12:42:49 -05:00
|
|
|
Scenario: Bike - Except tag and on no_ restrictions
|
|
|
|
Given the node map
|
|
|
|
| b | x | c |
|
|
|
|
| a | j | d |
|
|
|
|
| | s | |
|
|
|
|
|
|
|
|
And the ways
|
|
|
|
| nodes | oneway |
|
2013-01-05 11:35:50 -05:00
|
|
|
| sj | no |
|
2012-11-28 12:42:49 -05:00
|
|
|
| xj | -1 |
|
|
|
|
| aj | -1 |
|
2013-01-05 11:35:50 -05:00
|
|
|
| bj | no |
|
2012-11-28 12:42:49 -05:00
|
|
|
| cj | -1 |
|
|
|
|
| dj | -1 |
|
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction | except |
|
|
|
|
| restriction | sj | aj | j | no_left_turn | bicycle |
|
|
|
|
| restriction | sj | bj | j | no_left_turn | |
|
2013-01-04 10:09:00 -05:00
|
|
|
| restriction | sj | cj | j | no_right_turn | |
|
|
|
|
| restriction | sj | dj | j | no_right_turn | bicycle |
|
2012-11-28 12:42:49 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
|
|
|
| s | a | sj,aj |
|
|
|
|
| s | b | |
|
|
|
|
| s | c | |
|
|
|
|
| s | d | sj,dj |
|
|
|
|
|
2013-01-05 11:35:50 -05:00
|
|
|
@except
|
2012-11-28 12:42:49 -05:00
|
|
|
Scenario: Bike - Except tag and on only_ restrictions
|
|
|
|
Given the node map
|
|
|
|
| a | | b |
|
|
|
|
| | j | |
|
|
|
|
| | s | |
|
|
|
|
|
|
|
|
And the ways
|
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
2013-01-05 11:35:50 -05:00
|
|
|
| aj | no |
|
|
|
|
| bj | no |
|
2012-11-28 12:42:49 -05:00
|
|
|
|
|
|
|
And the relations
|
2012-11-30 07:40:21 -05:00
|
|
|
| type | way:from | way:to | node:via | restriction | except |
|
|
|
|
| restriction | sj | aj | j | only_straight_on | bicycle |
|
2012-11-28 12:42:49 -05:00
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
|
|
|
| s | a | sj,aj |
|
|
|
|
| s | b | sj,bj |
|
2013-01-06 09:44:15 -05:00
|
|
|
|
|
|
|
@except
|
|
|
|
Scenario: Bike - Multiple except tag values
|
|
|
|
Given the node map
|
|
|
|
| s | j | a |
|
|
|
|
| | | b |
|
|
|
|
| | | c |
|
|
|
|
| | | d |
|
|
|
|
| | | e |
|
|
|
|
| | | f |
|
|
|
|
|
|
|
|
And the ways
|
|
|
|
| nodes | oneway |
|
|
|
|
| sj | yes |
|
|
|
|
| ja | yes |
|
|
|
|
| jb | yes |
|
|
|
|
| jc | yes |
|
|
|
|
| jd | yes |
|
|
|
|
| je | yes |
|
|
|
|
| jf | yes |
|
|
|
|
|
|
|
|
And the relations
|
|
|
|
| type | way:from | way:to | node:via | restriction | except |
|
|
|
|
| restriction | sj | ja | j | no_straight_on | |
|
|
|
|
| restriction | sj | jb | j | no_straight_on | bicycle |
|
|
|
|
| restriction | sj | jc | j | no_straight_on | bus; bicycle |
|
|
|
|
| restriction | sj | jd | j | no_straight_on | bicycle; motocar |
|
|
|
|
| restriction | sj | je | j | no_straight_on | bus, bicycle |
|
|
|
|
| restriction | sj | jf | j | no_straight_on | bicycle, bus |
|
|
|
|
|
|
|
|
When I route I should get
|
|
|
|
| from | to | route |
|
|
|
|
| s | a | |
|
|
|
|
| s | b | sj,jb |
|
|
|
|
| s | c | sj,jc |
|
|
|
|
| s | d | sj,jd |
|
|
|
|
| s | e | |
|
|
|
|
| s | f | |
|