diff --git a/features/car/construction.feature b/features/car/construction.feature index d511b63974b..0ae2a5d429f 100644 --- a/features/car/construction.feature +++ b/features/car/construction.feature @@ -14,3 +14,4 @@ Feature: Car - all construction tags the OpenStreetMap community could think of | primary | | yes | | | primary | no | | x | | primary | widening | | x | + | primary | minor | | x | diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index ae81284b93a..fd0170754b0 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -53,42 +53,48 @@ function setup() }, access_tag_whitelist = Set { - 'yes', - 'permissive', - 'designated' + 'yes', + 'permissive', + 'designated' }, access_tag_blacklist = Set { - 'no', - 'private', - 'agricultural', - 'forestry', - 'delivery' + 'no', + 'private', + 'agricultural', + 'forestry', + 'delivery' }, restricted_access_tag_list = Set { }, restricted_highway_whitelist = Set { }, + construction_whitelist = Set { + 'no', + 'widening', + 'minor', + }, + access_tags_hierarchy = Sequence { - 'bicycle', - 'vehicle', - 'access' + 'bicycle', + 'vehicle', + 'access' }, restrictions = Set { - 'bicycle' + 'bicycle' }, cycleway_tags = Set { - 'track', - 'lane', - 'opposite', - 'opposite_lane', - 'opposite_track', - 'share_busway', - 'sharrow', - 'shared', + 'track', + 'lane', + 'opposite', + 'opposite_lane', + 'opposite_track', + 'share_busway', + 'sharrow', + 'shared', 'shared_lane' }, @@ -206,7 +212,7 @@ local function parse_maxspeed(source) return n end -function process_node (profile, node, result) +function process_node(profile, node, result) -- parse access and barrier tags local highway = node:get_value_by_key("highway") local is_crossing = highway and highway == "crossing" @@ -493,7 +499,7 @@ function handle_bicycle_tags(profile,way,result,data) end end end -function process_way (profile, way, result) +function process_way(profile, way, result) -- the initial filtering of ways based on presence of tags -- affects processing times significantly, because all ways -- have to be checked. diff --git a/profiles/car.lua b/profiles/car.lua index ceb26f498bd..eabd0a1944d 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -26,7 +26,7 @@ function setup() use_turn_restrictions = true, traffic_light_penalty = 2, }, - + default_mode = mode.driving, default_speed = 10, oneway_handling = true, @@ -140,19 +140,25 @@ function setup() ["drive-thru"] = 0.5 }, - restricted_highway_whitelist = Set { - 'motorway', - 'motorway_link', - 'trunk', - 'trunk_link', - 'primary', - 'primary_link', - 'secondary', - 'secondary_link', - 'tertiary', - 'tertiary_link', - 'residential', - 'living_street', + restricted_highway_whitelist = Set { + 'motorway', + 'motorway_link', + 'trunk', + 'trunk_link', + 'primary', + 'primary_link', + 'secondary', + 'secondary_link', + 'tertiary', + 'tertiary_link', + 'residential', + 'living_street', + }, + + construction_whitelist = Set { + 'no', + 'widening', + 'minor', }, route_speeds = { @@ -262,7 +268,7 @@ function setup() } end -function process_node (profile, node, result) +function process_node(profile, node, result) -- parse access and barrier tags local access = find_access_tag(node, profile.access_tags_hierarchy) if access then @@ -375,7 +381,7 @@ function process_way(profile, way, result) WayHandlers.run(profile,way,result,data,handlers) end -function process_turn (profile, turn) +function process_turn(profile, turn) -- Use a sigmoid function to return a penalty that maxes out at turn_penalty -- over the space of 0-180 degrees. Values here were chosen by fitting -- the function to some turn penalty samples from real driving. @@ -404,7 +410,7 @@ function process_turn (profile, turn) else turn.weight = turn.duration end - + if profile.properties.weight_name == 'routability' then -- penalize turns from non-local access only segments onto local access only tags if not turn.source_restricted and turn.target_restricted then diff --git a/profiles/foot.lua b/profiles/foot.lua index b5633b55aff..3e1c6fc1c79 100644 --- a/profiles/foot.lua +++ b/profiles/foot.lua @@ -57,6 +57,8 @@ function setup() restricted_highway_whitelist = Set { }, + construction_whitelist = Set {}, + access_tags_hierarchy = Sequence { 'foot', 'access' @@ -137,7 +139,7 @@ function setup() } end -function process_node (profile, node, result) +function process_node(profile, node, result) -- parse access and barrier tags local access = find_access_tag(node, profile.access_tags_hierarchy) if access then diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua index 61ebefd8b23..e5d08937419 100644 --- a/profiles/lib/way_handlers.lua +++ b/profiles/lib/way_handlers.lua @@ -521,7 +521,7 @@ function WayHandlers.blocked_ways(profile,way,result,data) 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 + if construction and not profile.construction_whitelist[construction] then return false end end