Skip to content

Commit adadb45

Browse files
chaupowTheMarex
authored andcommitted
make primaries and secondaries more dangerous
only apply oneway safety considerations on primaries re-adjust primary and secondary safeties
1 parent adee184 commit adadb45

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

profiles/bicycle.lua

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ function setup()
109109
-- reduce the driving speed by 30% for unsafe roads
110110
-- only used for cyclability metric
111111
unsafe_highway_list = {
112-
primary = 0.7,
113-
secondary = 0.75,
112+
primary = 0.5,
113+
secondary = 0.65,
114114
tertiary = 0.8,
115-
primary_link = 0.7,
116-
secondary_link = 0.75,
115+
primary_link = 0.5,
116+
secondary_link = 0.65,
117117
tertiary_link = 0.8,
118118
},
119119

@@ -373,10 +373,10 @@ function handle_bicycle_tags(profile,way,result,data)
373373
-- cycleway
374374
local has_cycleway_forward = false
375375
local has_cycleway_backward = false
376-
local is_oneway = result.forward_mode ~= mode.inaccessible and result.backward_mode ~= mode.inaccessible and not implied_oneway
376+
local is_twoway = result.forward_mode ~= mode.inaccessible and result.backward_mode ~= mode.inaccessible and not implied_oneway
377377

378378
-- cycleways on normal roads
379-
if is_oneway then
379+
if is_twoway then
380380
if cycleway and profile.cycleway_tags[cycleway] then
381381
has_cycleway_backward = true
382382
has_cycleway_forward = true
@@ -495,6 +495,15 @@ function handle_bicycle_tags(profile,way,result,data)
495495
if profile.properties.weight_name == 'cyclability' then
496496
local safety_penalty = profile.unsafe_highway_list[data.highway] or 1.
497497
local is_unsafe = safety_penalty < 1
498+
499+
-- primaries that are one ways are probably huge primaries where the lanes need to be separated
500+
if is_unsafe and data.highway == 'primary' and not is_twoway then
501+
safety_penalty = safety_penalty * 0.5
502+
end
503+
if is_unsafe and data.highway == 'secondary' and not is_twoway then
504+
safety_penalty = safety_penalty * 0.6
505+
end
506+
498507
local forward_is_unsafe = is_unsafe and not has_cycleway_forward
499508
local backward_is_unsafe = is_unsafe and not has_cycleway_backward
500509
local is_undesireable = data.highway == "service" and profile.service_penalties[service]

0 commit comments

Comments
 (0)