From 8d3ebc64dc3a1b871eb96e9e822f0a9e4617d8af Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Wed, 31 Mar 2021 00:28:01 +0100 Subject: [PATCH] Add kerb barrier exception to default car profile 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. --- CHANGELOG.md | 2 ++ features/car/barrier.feature | 12 ++++++++++++ profiles/car.lua | 13 ++++++++++++- taginfo.json | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c55f358b..4f9007696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/features/car/barrier.feature b/features/car/barrier.feature index 3f3220602..fd7e7f834 100644 --- a/features/car/barrier.feature +++ b/features/car/barrier.feature @@ -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 | diff --git a/profiles/car.lua b/profiles/car.lua index 856badd07..401f4bf45 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -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 diff --git a/taginfo.json b/taginfo.json index d7a5409b4..358845d80 100644 --- a/taginfo.json +++ b/taginfo.json @@ -125,6 +125,7 @@ {"key": "side_road", "value": "rotary", "description": "gets speed penalty"}, {"key": "route", "object_types": ["way"]}, {"key": "highway", "value": "traffic_signals", "object_types": ["node"]}, + {"key": "highway", "value": "crossing", "object_types": ["node"]}, {"key": "access", "value": "yes"}, {"key": "access", "value": "motorcar"}, {"key": "access", "value": "motor_vehicle"}, @@ -202,6 +203,7 @@ {"key": "barrier", "value": "lift_gate"}, {"key": "barrier", "value": "no"}, {"key": "barrier", "value": "entrance"}, + {"key": "barrier", "value": "kerb"}, {"key": "highway", "value": "motorway"}, {"key": "highway", "value": "motorway_link"}, {"key": "highway", "value": "trunk"}, @@ -220,6 +222,8 @@ {"key": "highway", "value": "movable"}, {"key": "highway", "value": "shuttle_train"}, {"key": "highway", "value": "default"}, + {"key": "kerb", "value": "lowered", "object_types": ["node"]}, + {"key": "kerb", "value": "flush", "object_types": ["node"]}, {"key": "width", "description": "Penalties for narrow streets"}, {"key": "lanes", "description": "Penalties for shared single lane streets"}, {"key": "lanes:forward", "description": "Lanes in forward direction"},