diff --git a/profiles/car.lua b/profiles/car.lua index 02f185abb..3563ff224 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -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, diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua index b13410235..93d7c6325 100644 --- a/profiles/lib/way_handlers.lua +++ b/profiles/lib/way_handlers.lua @@ -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)