Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support country trunk access in bicycle and foot profiles #7049

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
- Profiles:
- FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615)
- ADDED: Add optional support of cargo bike exclusion and width to bicyle profile [#7044](https://github.com/Project-OSRM/osrm-backend/pull/7044)
- FIXED: Support country trunk access in bicycle and foot profiles [#7049](https://github.com/Project-OSRM/osrm-backend/pull/7049)
- Routing:
- FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419)
- FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724)
Expand Down
7 changes: 7 additions & 0 deletions data/notrunk.geojson

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions docs/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ classes | Sequence | Determines the allowed
restrictions | Sequence | Determines which turn restrictions will be used for this profile.
suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES".
relation_types | Sequence | Determines which relations should be cached for processing in this profile. It contains relations types
uselocationtags | Set | Defines optional attributes that rely on location tags .e.g. 'trunk' will enable highway="trunk" support for the profile

### process_node(profile, node, result, relations)
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
Expand Down Expand Up @@ -375,3 +376,20 @@ There are a few helper functions defined in the global scope that profiles can u
- `trimLaneString`
- `applyAccessTokens`
- `canonicalizeStringList`

### osrm-extract location dependent data
The creation of the dataset for routing use requires preprocessing of the osm data source.
The first preprocessing step is via osrm-extract.
Certain data (like driving-side or vehicle height) may be different between areas.
The "--location-dependent-data" command option can be used to pass geojson polygon data to support this differentiation.

### Highway support for Trunk Roads
The default routing profiles foot.lua and bicycle.lua do not allow access on ways with highway="trunk" or highway="trunk_link".
The wiki page outlining access restrictions ("https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions") outlines seven countries that do not allow such access.
If the setup option uselocationtags includes 'trunk' then access is changed to yes for all countries.
To support routing data that honours different trunk access

- confirm uselocationtags = 'trunk' is set
- osrm-extract --location-dependent-data data/notrunk.geojson ...

This geojson sets the notrunk option for the seven countries (Austria, Belgium, Denmark, France, Hungary, Slovakia and Switzerland).
39 changes: 38 additions & 1 deletion features/bicycle/way.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Bike - Accessability of different way types
Background:
Given the profile "bicycle"

Scenario: Bike - Routability of way types
Scenario: Bike - Routability of way types trunk not supported
# Bikes are allowed on footways etc because you can pull your bike at a lower speed.
# Pier is not allowed, since it's tagged using man_made=pier.

Expand Down Expand Up @@ -40,3 +40,40 @@ Feature: Bike - Accessability of different way types
| highway | man_made | bothw |
| (nil) | (nil) | |
| (nil) | pier | x |

Scenario: Bike - Routability of way types trunk supported
# Bikes are allowed on footways etc because you can pull your bike at a lower speed.
# Pier is not allowed, since it's tagged using man_made=pier.

Given the profile file "bicycle" initialized with
"""
profile.uselocationtags.trunk = true
"""

Then routability should be
| highway | bothw |
| (nil) | |
| motorway | |
| motorway_link | |
| trunk | x |
| trunk_link | x |
| primary | x |
| primary_link | x |
| secondary | x |
| secondary_link | x |
| tertiary | x |
| tertiary_link | x |
| residential | x |
| service | x |
| unclassified | x |
| living_street | x |
| road | x |
| track | x |
| path | x |
| footway | x |
| pedestrian | x |
| steps | x |
| cycleway | x |
| bridleway | |
| pier | |

183 changes: 183 additions & 0 deletions features/bicycle/way_notrunk.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
@testbot @way @notrunk
Feature: Testbot - notrunk allowed

# Check that Nodes need to be in the geojson file to support trunk access.
# Use the default geopoint around 0.0.
# This covers both trunk allowed notrunk allowed and no motorroad

Scenario: bicycle trunk allowed - notrunk failure original behavior

Given the profile "bicycle"
And the extract extra arguments "--threads 1"
And the partition extra arguments "--threads 1"
And the customize extra arguments "--threads 1"

And the node locations
# f through o should all fail

| node | lat | lon |
| a | 48.65729 | 22.26471 |
| b | 48.65648 | 22.26486 |
| c | 48.65503 | 22.26521 |
| d | 48.65489 | 22.26520 |
| e | 48.65426 | 22.26533 |
| f | 48.65277 | 22.26556 |
| g | 48.65026 | 22.26606 |
| h | 48.64937 | 22.26618 |
| i | 48.64858 | 22.26634 |
| j | 48.64763 | 22.26652 |
| k | 48.64730 | 22.26658 |
| l | 48.64616 | 22.26681 |
| m | 48.64599 | 22.26685 |
| n | 48.64568 | 22.26690 |


And the ways
| nodes | highway | motorroad |
| ab | primary | |
| bc | primary | |
| cd | primary | yes |
| de | primary | |
| ef | primary | |
| fg | trunk | |
| gh | trunk | |
| hi | trunk | |
| ij | trunk | |
| jk | trunk | |
| kl | trunk | |
| lm | trunk | yes |
| mn | primary | |

When I route I should get
| from | to | route | status| message | # |
| a | c | ab,bc,bc | 200 | | |
| a | f | | 400 | Impossible route between points | |
| d | f | de,ef,ef | 200 | | |
| d | g | de,ef,ef | 200 | | |
| d | n | | 400 | Impossible route between points | |

Scenario: bicycle trunk allowed - trunk ok with no geojson

Given the extract extra arguments "--threads 1"
And the partition extra arguments "--threads 1"
And the customize extra arguments "--threads 1"

And the profile file "bicycle" initialized with
"""
profile.uselocationtags.trunk = true
"""

And the node locations
# a through g are in Slovakia - in the no trunk allowed set
# h is on the edge (i.e. in Ukraine)
# i through n are in Ukraine

| node | lat | lon |
| a | 48.65729 | 22.26471 |
| b | 48.65648 | 22.26486 |
| c | 48.65503 | 22.26521 |
| d | 48.65489 | 22.26520 |
| e | 48.65426 | 22.26533 |
| f | 48.65277 | 22.26556 |
| g | 48.65026 | 22.26606 |
| h | 48.64937 | 22.26618 |
| i | 48.64858 | 22.26634 |
| j | 48.64763 | 22.26652 |
| k | 48.64730 | 22.26658 |
| l | 48.64616 | 22.26681 |
| m | 48.64599 | 22.26685 |
| n | 48.64568 | 22.26690 |


And the ways
| nodes | highway | motorroad |
| ab | primary | |
| bc | primary | |
| cd | primary | yes |
| de | primary | |
| ef | primary | |
| fg | trunk | |
| gh | trunk | |
| hi | trunk | |
| ij | trunk | |
| jk | trunk | |
| kl | trunk | |
| lm | trunk | yes |
| mn | primary | |

When I route I should get
| from | to | route | status| message | # |
| a | c | ab,bc,bc | 200 | | |
| a | d | | 400 | Impossible route between points | |
| d | f | de,ef,ef | 200 | | |
| d | g | de,ef,fg,fg | 200 | | |
| e | n | | 400 | Impossible route between points | |
| f | h | fg,gh | 200 | | |
| g | l | gh,ij,kl,kl | 200 | | |
| h | l | hi,ij,kl,kl | 200 | | |
| i | l | ij,kl,kl | 200 | | |
| i | m | | 400 | Impossible route between points | |

Scenario: bicycle trunk allowed - notrunk failure with geojson

Given the extract extra arguments "--threads 1 --location-dependent-data data/notrunk.geojson"
And the partition extra arguments "--threads 1"
And the customize extra arguments "--threads 1"

And the profile file "bicycle" initialized with
"""
profile.uselocationtags.trunk = true
"""

And the node locations
# a through g are in Slovakia - in the no trunk allowed set
# h is on the edge (i.e. in Ukraine)
# i through n are in Ukraine

| node | lat | lon |
| a | 48.65729 | 22.26471 |
| b | 48.65648 | 22.26486 |
| c | 48.65503 | 22.26521 |
| d | 48.65489 | 22.26520 |
| e | 48.65426 | 22.26533 |
| f | 48.65277 | 22.26556 |
| g | 48.65026 | 22.26606 |
| h | 48.64937 | 22.26618 |
| i | 48.64858 | 22.26634 |
| j | 48.64763 | 22.26652 |
| k | 48.64730 | 22.26658 |
| l | 48.64616 | 22.26681 |
| m | 48.64599 | 22.26685 |
| n | 48.64568 | 22.26690 |


And the ways
| nodes | highway | motorroad |
| ab | primary | |
| bc | primary | |
| cd | primary | yes |
| de | primary | |
| ef | primary | |
| fg | trunk | |
| gh | trunk | |
| hi | trunk | |
| ij | trunk | |
| jk | trunk | |
| kl | trunk | |
| lm | trunk | yes |
| mn | primary | |

When I route I should get
| from | to | route | status| message | # |
| a | c | ab,bc,bc | 200 | | |
| a | d | | 400 | Impossible route between points | |
| a | f | | 400 | Impossible route between points | |
| d | f | de,ef,ef | 200 | | |
| d | g | | 400 | Impossible route between points | |
| e | n | | 400 | Impossible route between points | |
| f | h | | 400 | Impossible route between points | |
| g | l | hi,ij,kl,kl | 200 | | |
| h | l | hi,ij,kl,kl | 200 | | |
| i | l | ij,kl,kl | 200 | | |
| i | m | | 400 | Impossible route between points | |

34 changes: 34 additions & 0 deletions features/foot/way.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,37 @@ Feature: Foot - Accessability of different way types
| footway | | | x |
| proposed | | | |
| proposed | yes | yes | |

Scenario: Foot - Basic access with profile.uselocationtags.trunk = true

Given the profile file "foot" initialized with
"""
profile.uselocationtags.trunk = true
"""

Then routability should be
| highway | forw |
| motorway | |
| motorway_link | |
| trunk | x |
| trunk_link | x |
| primary | x |
| primary_link | x |
| secondary | x |
| secondary_link | x |
| tertiary | x |
| tertiary_link | x |
| residential | x |
| service | x |
| unclassified | x |
| living_street | x |
| road | x |
| track | x |
| path | x |
| footway | x |
| pedestrian | x |
| steps | x |
| pier | x |
| cycleway | |
| bridleway | |

Loading