From 8bee57b0b01c2c7085bce657771aac3f147fd0d1 Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Thu, 4 Aug 2016 12:04:49 +0200 Subject: [PATCH] Makes toll=yes way's routability configurable in profiles. The primary use-case is conditionally filtering ways such as: https://www.openstreetmap.org/edit#map=18/38.94198/-77.28127 which we are guiding the user onto in the route from DC to IAD: http://map.project-osrm.org/?z=12¢er=38.934443%2C-77.167969&loc=38.902656%2C-77.029095&loc=38.952210%2C-77.453424&hl=en&alt=0 This changeset makes `toll=yes` configurable in the profiles, disabling them by default. Neither do we support time-based fees nor vehicle category fees at the moment. References: - http://wiki.openstreetmap.org/wiki/Key:toll --- features/car/access.feature | 7 +++++++ profiles/car.lua | 7 +++++++ taginfo.json | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/features/car/access.feature b/features/car/access.feature index 4e614a600..3cf79975d 100644 --- a/features/car/access.feature +++ b/features/car/access.feature @@ -155,3 +155,10 @@ Feature: Car - Restricted access | primary | designated | | | primary | yes | x | | primary | no | x | + + Scenario: Car - only toll=yes ways are ignored by default + Then routability should be + | highway | toll | bothw | + | primary | yes | | + | primary | no | x | + | primary | snowmobile | x | diff --git a/profiles/car.lua b/profiles/car.lua index c5c57291c..28fc9df84 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -149,6 +149,7 @@ local turn_bias = 1.2 local obey_oneway = true local ignore_areas = true local ignore_hov_ways = true +local ignore_toll_ways = true local abs = math.abs local min = math.min @@ -240,6 +241,12 @@ function way_function (way, result) return end + -- respect user-preference for toll=yes ways + local toll = way:get_value_by_key("toll") + if ignore_toll_ways and toll and "yes" == toll then + return + end + -- check if oneway tag is unsupported local oneway = way:get_value_by_key("oneway") if oneway and "reversible" == oneway then diff --git a/taginfo.json b/taginfo.json index 2760a6fc9..b8168379e 100644 --- a/taginfo.json +++ b/taginfo.json @@ -52,6 +52,12 @@ "object_types": [ "way" ], "description": "Roads with hov=designated are ignored by default." }, + { + "key": "toll", + "value": "yes", + "object_types": [ "way" ], + "description": "Roads with toll=yes are ignored by default." + }, { "key": "impassable", "description": "This is used by HOT."