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

Add a weight for bicycle=discouraged tag in OSRM profile #1159

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ function setup()
properties = {
u_turn_penalty = 20,
traffic_light_penalty = 15,
--weight_name = 'cyclability',
weight_name = 'routability',
-- Transition: we prefer cyclability as a baseline
weight_name = 'cyclability',
--weight_name = 'routability',
process_call_tagless_node = false,
max_speed_for_map_matching = 110/3.6, -- kmph -> m/s
use_turn_restrictions = false,
Expand Down Expand Up @@ -600,6 +601,14 @@ function safety_handler(profile,way,result,data)
backward_penalty = math.min(backward_penalty, profile.service_penalties[data.service])
end

-- Transition: Add penalty for bicycle=discouraged tag
-- See the link above about the discouraged tag
local bicycle_tag = way:get_value_by_key("bicycle")
if bicycle_tag == "discouraged" then
forward_penalty = forward_penalty * 0.5
backward_penalty = backward_penalty * 0.5
end

if result.forward_speed > 0 then
-- convert from km/h to m/s
result.forward_rate = result.forward_speed / 3.6 * forward_penalty
Expand Down
Loading