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
This commit is contained in:
		
							parent
							
								
									6bfe3a2d41
								
							
						
					
					
						commit
						8bee57b0b0
					
				| @ -155,3 +155,10 @@ Feature: Car - Restricted access | |||||||
|             | primary | designated |       | |             | primary | designated |       | | ||||||
|             | primary | yes        | x     | |             | primary | yes        | x     | | ||||||
|             | primary | no         | 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     | | ||||||
|  | |||||||
| @ -149,6 +149,7 @@ local turn_bias                  = 1.2 | |||||||
| local obey_oneway                = true | local obey_oneway                = true | ||||||
| local ignore_areas               = true | local ignore_areas               = true | ||||||
| local ignore_hov_ways            = true | local ignore_hov_ways            = true | ||||||
|  | local ignore_toll_ways           = true | ||||||
| 
 | 
 | ||||||
| local abs = math.abs | local abs = math.abs | ||||||
| local min = math.min | local min = math.min | ||||||
| @ -240,6 +241,12 @@ function way_function (way, result) | |||||||
|     return |     return | ||||||
|   end |   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 |   -- check if oneway tag is unsupported | ||||||
|   local oneway = way:get_value_by_key("oneway") |   local oneway = way:get_value_by_key("oneway") | ||||||
|   if oneway and "reversible" == oneway then |   if oneway and "reversible" == oneway then | ||||||
|  | |||||||
| @ -52,6 +52,12 @@ | |||||||
|             "object_types": [ "way" ], |             "object_types": [ "way" ], | ||||||
|             "description": "Roads with hov=designated are ignored by default." |             "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", |             "key": "impassable", | ||||||
|             "description": "This is used by HOT." |             "description": "This is used by HOT." | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user