Merge branch 'frodrigo-develop' into develop
This commit is contained in:
		
						commit
						22da5be08e
					
				| @ -8,31 +8,35 @@ OSRM will use 4/5 of the projected free-flow speed. | |||||||
| 
 | 
 | ||||||
|     Scenario: Car - Respect maxspeeds when lower that way type speed |     Scenario: Car - Respect maxspeeds when lower that way type speed | ||||||
|         Given the node map |         Given the node map | ||||||
|             | a | b | c | |             | a | b | c | d | | ||||||
| 
 | 
 | ||||||
|         And the ways |         And the ways | ||||||
|             | nodes | highway | maxspeed | |             | nodes | highway | maxspeed | | ||||||
|             | ab    | trunk   |          | |             | ab    | trunk   |          | | ||||||
|             | bc    | trunk   | 60       | |             | bc    | trunk   | 60       | | ||||||
|  |             | cd    | trunk   | FR:urban | | ||||||
| 
 | 
 | ||||||
|         When I route I should get |         When I route I should get | ||||||
|             | from | to | route | speed        | |             | from | to | route | speed        | | ||||||
|             | a    | b  | ab    | 67 km/h      | |             | a    | b  | ab    | 67 km/h      | | ||||||
|             | b    | c  | bc    | 48 km/h +- 1 | |             | b    | c  | bc    | 48 km/h +- 1 | | ||||||
|  |             | c    | d  | cd    | 40 km/h      | | ||||||
| 
 | 
 | ||||||
|     Scenario: Car - Do not ignore maxspeed when higher than way speed |     Scenario: Car - Do not ignore maxspeed when higher than way speed | ||||||
|         Given the node map |         Given the node map | ||||||
|             | a | b | c | |             | a | b | c | d | | ||||||
| 
 | 
 | ||||||
|         And the ways |         And the ways | ||||||
|             | nodes | highway       | maxspeed | |             | nodes | highway       | maxspeed | | ||||||
|             | ab    | residential   |          | |             | ab    | residential   |          | | ||||||
|             | bc    | residential   | 90       | |             | bc    | residential   | 90       | | ||||||
|  |             | cd    | living_street | FR:urban | | ||||||
| 
 | 
 | ||||||
|         When I route I should get |         When I route I should get | ||||||
|             | from | to | route | speed        | |             | from | to | route | speed        | | ||||||
|             | a    | b  | ab    | 20 km/h      | |             | a    | b  | ab    | 20 km/h      | | ||||||
|             | b    | c  | bc    | 72 km/h +- 1 | |             | b    | c  | bc    | 72 km/h +- 1 | | ||||||
|  |             | c    | d  | cd    | 40 km/h      | | ||||||
| 
 | 
 | ||||||
|     Scenario: Car - Forward/backward maxspeed |     Scenario: Car - Forward/backward maxspeed | ||||||
|         Given a grid size of 100 meters |         Given a grid size of 100 meters | ||||||
|  | |||||||
							
								
								
									
										44
									
								
								profiles/car.lua
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										44
									
								
								profiles/car.lua
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @ -32,6 +32,36 @@ speed_profile = { | |||||||
|   ["default"] = 10 |   ["default"] = 10 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | -- http://wiki.openstreetmap.org/wiki/Speed_limits | ||||||
|  | maxspeed_table_default = { | ||||||
|  |   ["urban"] = 50, | ||||||
|  |   ["rural"] = 90, | ||||||
|  |   ["trunk"] = 110, | ||||||
|  |   ["motorway"] = 130 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | -- List only exceptions | ||||||
|  | maxspeed_table = { | ||||||
|  |   ["de:living_street"] = 7, | ||||||
|  |   ["ru:living_street"] = 20, | ||||||
|  |   ["ru:urban"] = 60, | ||||||
|  |   ["ua:urban"] = 60, | ||||||
|  |   ["at:rural"] = 100, | ||||||
|  |   ["de:rural"] = 100, | ||||||
|  |   ["at:trunk"] = 100, | ||||||
|  |   ["cz:trunk"] = 0, | ||||||
|  |   ["ro:trunk"] = 100, | ||||||
|  |   ["cz:motorway"] = 0, | ||||||
|  |   ["de:motorway"] = 0, | ||||||
|  |   ["ru:motorway"] = 110, | ||||||
|  |   ["gb:nsl_single"] = (60*1609)/1000, | ||||||
|  |   ["gb:nsl_dual"] = (70*1609)/1000, | ||||||
|  |   ["gb:motorway"] = (70*1609)/1000, | ||||||
|  |   ["uk:nsl_single"] = (60*1609)/1000, | ||||||
|  |   ["uk:nsl_dual"] = (70*1609)/1000, | ||||||
|  |   ["uk:motorway"] = (70*1609)/1000 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| traffic_signal_penalty          = 2 | traffic_signal_penalty          = 2 | ||||||
| 
 | 
 | ||||||
| -- End of globals | -- End of globals | ||||||
| @ -74,11 +104,21 @@ local function parse_maxspeed(source) | |||||||
|     return 0 |     return 0 | ||||||
|   end |   end | ||||||
|   local n = tonumber(source:match("%d*")) |   local n = tonumber(source:match("%d*")) | ||||||
|  |   if n then | ||||||
|  |     if string.match(source, "mph") or string.match(source, "mp/h") then | ||||||
|  |       n = (n*1609)/1000; | ||||||
|  |     end | ||||||
|  |   else | ||||||
|  |     -- parse maxspeed like FR:urban | ||||||
|  |     source = string.lower(source) | ||||||
|  |     n = maxspeed_table[source] | ||||||
|  |     if not n then | ||||||
|  |       local highway_type = string.match(source, "%a%a:(%a+)") | ||||||
|  |       n = maxspeed_table_default[highway_type] | ||||||
|       if not n then |       if not n then | ||||||
|         n = 0 |         n = 0 | ||||||
|       end |       end | ||||||
|   if string.match(source, "mph") or string.match(source, "mp/h") then |     end | ||||||
|     n = (n*1609)/1000; |  | ||||||
|   end |   end | ||||||
|   return n |   return n | ||||||
| end | end | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user