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

Makes construction=minor ways routable again, see #4258 #4306

Merged
merged 3 commits into from
Jul 19, 2017
Merged
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 features/car/construction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
50 changes: 28 additions & 22 deletions profiles/bicycle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down
40 changes: 23 additions & 17 deletions profiles/car.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function setup()
use_turn_restrictions = true,
traffic_light_penalty = 2,
},

default_mode = mode.driving,
default_speed = 10,
oneway_handling = true,
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion profiles/foot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ function setup()

restricted_highway_whitelist = Set { },

construction_whitelist = Set {},
Copy link
Contributor

@emiltin emiltin Jul 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not needed, since avoid construction is not activated in the foot profile?


access_tags_hierarchy = Sequence {
'foot',
'access'
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion profiles/lib/way_handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down