penalize toll roads instead of excluding them

This commit is contained in:
Kajari Ghosh 2019-01-08 11:46:15 -05:00
parent 2c78d862a3
commit 4c6adeee0f
2 changed files with 23 additions and 0 deletions

View File

@ -416,6 +416,9 @@ function process_way(profile, way, result, relations)
-- handle hov
WayHandlers.hov,
-- apply high penalty for turns onto toll roads, starting on them still works
WayHandlers.penalize_toll_roads,
-- compute speed taking into account way type, maxspeed tags, etc.
WayHandlers.speed,
WayHandlers.surface,

View File

@ -221,6 +221,26 @@ function WayHandlers.hov(profile,way,result,data)
end
end
-- set restricted flags for toll roads; later on the profile can apply turn penalties
function WayHandlers.penalize_toll_roads(profile,way,result,data)
-- if user tells us to avoid toll roads completely,
-- there is no need to set high penalties
if profile.avoid.toll then
return
end
local toll = way:get_value_by_key("toll")
if "yes" == toll then
result.forward_restricted = true
result.backward_restricted = true
end
-- Todo:
-- - forward/backward namespaces
-- - other tag values not only "yes"
end
-- set highway and access classification by user preference
function WayHandlers.way_classification_for_turn(profile,way,result,data)