For the cyclability profile add alley penalties
This commit is contained in:
parent
21cd1a44e8
commit
f3de2c9b94
@ -101,6 +101,10 @@ local profile = {
|
|||||||
'tertiary_link'
|
'tertiary_link'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
service_penalties = {
|
||||||
|
alley = 0.5,
|
||||||
|
},
|
||||||
|
|
||||||
bicycle_speeds = {
|
bicycle_speeds = {
|
||||||
cycleway = default_speed,
|
cycleway = default_speed,
|
||||||
primary = default_speed,
|
primary = default_speed,
|
||||||
@ -480,29 +484,29 @@ function way_function (way, result)
|
|||||||
limit( result, maxspeed, maxspeed_forward, maxspeed_backward )
|
limit( result, maxspeed, maxspeed_forward, maxspeed_backward )
|
||||||
|
|
||||||
-- convert duration into cyclability
|
-- convert duration into cyclability
|
||||||
local is_unsafe = profile.safety_penalty < 1 and profile.unsafe_highway_list[data.highway]
|
if properties.weight_name == 'cyclability' then
|
||||||
if result.forward_speed > 0 then
|
local is_unsafe = profile.safety_penalty < 1 and profile.unsafe_highway_list[data.highway]
|
||||||
-- convert from km/h to m/s
|
local is_undesireable = data.highway == "service" and profile.service_penalties[service]
|
||||||
result.forward_rate = result.forward_speed / 3.6;
|
local penalty = 1.0
|
||||||
if is_unsafe then
|
if is_unsafe then
|
||||||
result.forward_rate = result.forward_rate * profile.safety_penalty
|
penalty = math.min(penalty, profile.safety_penalty)
|
||||||
end
|
end
|
||||||
end
|
if is_undesireable then
|
||||||
if result.backward_speed > 0 then
|
penalty = math.min(penalty, profile.service_penalties[service])
|
||||||
-- convert from km/h to m/s
|
end
|
||||||
result.backward_rate = result.backward_speed / 3.6;
|
|
||||||
if is_unsafe then
|
|
||||||
result.backward_rate = result.backward_rate * profile.safety_penalty
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if result.duration > 0 then
|
|
||||||
result.weight = result.duration;
|
|
||||||
if is_unsafe then
|
|
||||||
result.weight = result.weight * (1+profile.safety_penalty)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
if result.forward_speed > 0 then
|
||||||
|
-- convert from km/h to m/s
|
||||||
|
result.forward_rate = result.forward_speed / 3.6 * penalty
|
||||||
|
end
|
||||||
|
if result.backward_speed > 0 then
|
||||||
|
-- convert from km/h to m/s
|
||||||
|
result.backward_rate = result.backward_speed / 3.6 * penalty
|
||||||
|
end
|
||||||
|
if result.duration > 0 then
|
||||||
|
result.weight = result.duration / penalty
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local handlers = Sequence {
|
local handlers = Sequence {
|
||||||
-- compute speed taking into account way type, maxspeed tags, etc.
|
-- compute speed taking into account way type, maxspeed tags, etc.
|
||||||
|
Loading…
Reference in New Issue
Block a user