penalize toll roads instead of excluding them
This commit is contained in:
parent
2c78d862a3
commit
4c6adeee0f
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user