implements a penalty for very narrow road:

- implements discussion of #1388
- implements basic test cases
This commit is contained in:
Dennis Luxen 2015-02-19 15:17:04 +01:00
parent e9e12b88f8
commit 4c4c126361
2 changed files with 35 additions and 0 deletions

View File

@ -73,3 +73,23 @@ OSRM will use 4/5 of the projected free-flow speed.
| runway | | | 100 | | | |
| runway | | | | 100 | | |
| runway | | | | | 100 | |
Scenario: Car - Too narrow streets should be ignored or incur a penalty
Then routability should be
| highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw |
| primary | | | | | 63 km/h | 63 km/h |
| primary | | 3 | | | 31 km/h | 31 km/h |
| primary | 60 | | | | 59 km/h | 59 km/h |
| primary | 60 | 3 | | | 29 km/h | 29 km/h |
| primary | | | 60 | | 59 km/h | 63 km/h |
| primary | | 3 | 60 | | 29 km/h | 31 km/h |
| primary | | | | 60 | 63 km/h | 59 km/h |
| primary | | 3 | | 60 | 31 km/h | 29 km/h |
| primary | 15 | | 60 | | 59 km/h | 23 km/h |
| primary | 15 | 3 | 60 | | 29 km/h | 11 km/h |
| primary | 15 | | | 60 | 23 km/h | 59 km/h |
| primary | 15 | 3 | | 60 | 11 km/h | 29 km/h |
| primary | 15 | | 30 | 60 | 34 km/h | 59 km/h |
| primary | 15 | 3 | 30 | 60 | 17 km/h | 29 km/h |

View File

@ -248,6 +248,13 @@ function way_function (way, result)
return
end
local width = math.huge
local width_string = way:get_value_by_key("width")
if width_string and tonumber(width_string:match("%d*")) then
width = tonumber(width_string:match("%d*"))
io.write("width: "..width.."\n")
end
-- Check if we are allowed to access the way
local access = find_access_tag(way, access_tags_hierachy)
if access_tag_blacklist[access] then
@ -385,12 +392,20 @@ function way_function (way, result)
result.ignore_in_grid = true
end
-- scale speeds to get better avg driving times
if result.forward_speed > 0 then
result.forward_speed = result.forward_speed*speed_reduction + 11;
if width <= 3 then
result.forward_speed = result.forward_speed / 2;
end
end
if result.backward_speed > 0 then
result.backward_speed = result.backward_speed*speed_reduction + 11;
if width <= 3 then
result.backward_speed = result.backward_speed / 2;
end
end
end