Skip to content

Commit

Permalink
Remove highway=bicycle safety bonys
Browse files Browse the repository at this point in the history
This removes a bonus for a road class that doesn't exist (cycleway would
be correct), but the code was buggy since safety_bonus is nil and caused
an arithmetic exception. We only caught this 4 (!) years later since
recently a way was tagged with highway=bicycle and made it in our OSM
data leading to preprocessing failures.
  • Loading branch information
TheMarex committed Aug 4, 2022
1 parent e7185b4 commit 3f8c1d6
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions profiles/bicycle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -543,21 +543,6 @@ function safety_handler(profile,way,result,data)
if result.duration > 0 then
result.weight = result.duration / forward_penalty
end

if data.highway == "bicycle" then
safety_bonus = safety_bonus + 0.2
if result.forward_speed > 0 then
-- convert from km/h to m/s
result.forward_rate = result.forward_speed / 3.6 * safety_bonus
end
if result.backward_speed > 0 then
-- convert from km/h to m/s
result.backward_rate = result.backward_speed / 3.6 * safety_bonus
end
if result.duration > 0 then
result.weight = result.duration / safety_bonus
end
end
end
end

Expand Down

0 comments on commit 3f8c1d6

Please sign in to comment.