From 6a555a477b95824e8e2846e5fb948ea59f8f2a80 Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Sat, 8 Jul 2017 18:49:01 +0200 Subject: [PATCH] Discards construction and proposed ways, resolves #4230 --- features/car/construction.feature | 16 ++++++++++++++++ profiles/bicycle.lua | 3 ++- profiles/car.lua | 4 +++- profiles/foot.lua | 4 +++- profiles/lib/handlers.lua | 19 +++++++++++++++++++ taginfo.json | 10 ++++++++++ 6 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 features/car/construction.feature diff --git a/features/car/construction.feature b/features/car/construction.feature new file mode 100644 index 000000000..d511b6397 --- /dev/null +++ b/features/car/construction.feature @@ -0,0 +1,16 @@ +@routing @car @construction +Feature: Car - all construction tags the OpenStreetMap community could think of and then some + + Background: + Given the profile "car" + + Scenario: Various ways to tag construction and proposed roads + Then routability should be + | highway | construction | proposed | bothw | + | primary | | | x | + | construction | | | | + | proposed | | | | + | primary | yes | | | + | primary | | yes | | + | primary | no | | x | + | primary | widening | | x | diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index a6a2926ef..4fe779501 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -189,7 +189,8 @@ local profile = { avoid = Set { 'impassable', - 'construction' + 'construction', + 'proposed' } } diff --git a/profiles/car.lua b/profiles/car.lua index c86503dac..7418f732f 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -110,7 +110,9 @@ local profile = { 'reversible', 'impassable', 'hov_lanes', - 'steps' + 'steps', + 'construction', + 'proposed' }, speeds = Sequence { diff --git a/profiles/foot.lua b/profiles/foot.lua index 1749b23b7..c715b0c2a 100644 --- a/profiles/foot.lua +++ b/profiles/foot.lua @@ -76,7 +76,9 @@ local profile = { }, avoid = Set { - 'impassable' + 'impassable', + 'construction', + 'proposed' }, speeds = Sequence { diff --git a/profiles/lib/handlers.lua b/profiles/lib/handlers.lua index db7365d84..0b9381c75 100644 --- a/profiles/lib/handlers.lua +++ b/profiles/lib/handlers.lua @@ -513,6 +513,25 @@ function Handlers.handle_blocked_ways(way,result,data,profile) return false end + -- In addition to the highway=construction tag above handle the construction=* tag + -- http://wiki.openstreetmap.org/wiki/Key:construction + -- https://taginfo.openstreetmap.org/keys/construction#values + if profile.avoid.construction then + local construction = way:get_value_by_key('construction') + + -- Of course there are negative tags to handle, too + if construction and construction ~= 'no' and construction ~= 'widening' then + return false + end + end + + -- Not only are there multiple construction tags there is also a proposed=* tag. + -- http://wiki.openstreetmap.org/wiki/Key:proposed + -- https://taginfo.openstreetmap.org/keys/proposed#values + if profile.avoid.proposed and way:get_value_by_key('proposed') then + return false + end + -- Reversible oneways change direction with low frequency (think twice a day): -- do not route over these at all at the moment because of time dependence. -- Note: alternating (high frequency) oneways are handled below with penalty. diff --git a/taginfo.json b/taginfo.json index 02470a20f..ca7da94ab 100644 --- a/taginfo.json +++ b/taginfo.json @@ -366,6 +366,16 @@ "value": "circular", "description": "A Roundabout where the traffic on the roundabout not always has right of way." }, + { + "key": "proposed", + "object_types": [ "way" ], + "description": "Proposed ways. Discarded for routing" + }, + { + "key": "construction", + "object_types": [ "way" ], + "description": "Ways under construction. Discarded for routing except construction=no, construction=widening" + }, { "key": "type", "value": "restriction",