Skip to content

Commit

Permalink
Add kerb barrier exception to default car profile
Browse files Browse the repository at this point in the history
OSM data contains many mistakes that tag kerbs as highway barriers
when instead they are only describing highway crossings.

This PR updates the default car profile to handle these mistakes
and unblock routing on the affected highways.
  • Loading branch information
mjjbell committed Mar 30, 2021
1 parent c15b02e commit cceaf5a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- Misc:
- FIXED: Upgrade to @mapbox/node-pre-gyp fix various bugs with Node 12/14 [#5991](https://github.com/Project-OSRM/osrm-backend/pull/5991)
- FIXED: `valid` type in documentation examples [#5990](https://github.com/Project-OSRM/osrm-backend/issues/5990)
- Profile:
- FIXED: Add kerb barrier exception to default car profile. [#5999](https://github.com/Project-OSRM/osrm-backend/pull/5999)

# 5.24.0
- Changes from 5.23.0
Expand Down
12 changes: 12 additions & 0 deletions features/car/barrier.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ Feature: Car - Barriers
| bollard | rising | x |
| bollard | removable | |

# https://github.com/Project-OSRM/osrm-backend/issues/5996
Scenario: Car - Kerb exception for barriers
Then routability should be
| node/barrier | node/highway | node/kerb | bothw |
| kerb | | | |
| kerb | crossing | | x |
| kerb | crossing | yes | x |
| kerb | | lowered | x |
| kerb | | flush | x |
| kerb | | raised | |
| kerb | | yes | |

Scenario: Car - Height restrictions
Then routability should be
| node/barrier | node/maxheight | bothw |
Expand Down
13 changes: 12 additions & 1 deletion profiles/car.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,18 @@ function process_node(profile, node, result, relations)
local bollard = node:get_value_by_key("bollard")
local rising_bollard = bollard and "rising" == bollard

if not profile.barrier_whitelist[barrier] and not rising_bollard or restricted_by_height then
-- make an exception for lowered/flat barrier=kerb
-- and incorrect tagging of highway crossing kerb as highway barrier
local kerb = node:get_value_by_key("kerb")
local highway = node:get_value_by_key("highway")
local flat_kerb = kerb and ("lowered" == kerb or "flush" == kerb)
local highway_crossing_kerb = barrier == "kerb" and highway and highway == "crossing"

if not profile.barrier_whitelist[barrier]
and not rising_bollard
and not flat_kerb
and not highway_crossing_kerb
or restricted_by_height then
result.barrier = true
end
end
Expand Down

0 comments on commit cceaf5a

Please sign in to comment.