Only penaltize bidirectional ways if they have 1 lane
This commit is contained in:
parent
dddde4ddab
commit
8a2652f53d
@ -112,3 +112,11 @@ OSRM will use 4/5 of the projected free-flow speed.
|
|||||||
| primary | 15 | | 30 | 60 | 34 km/h | 59 km/h |
|
| primary | 15 | | 30 | 60 | 34 km/h | 59 km/h |
|
||||||
| primary | 15 | 1 | 30 | 60 | 15 km/h | 30 km/h |
|
| primary | 15 | 1 | 30 | 60 | 15 km/h | 30 km/h |
|
||||||
|
|
||||||
|
Scenario: Car - Single lane streets only incure a penalty for two-way streets
|
||||||
|
Then routability should be
|
||||||
|
| highway | maxspeed | lanes | oneway | forw | backw |
|
||||||
|
| primary | 30 | 1 | yes | 34 km/h | |
|
||||||
|
| primary | 30 | 1 | -1 | | 34 km/h |
|
||||||
|
| primary | 30 | 1 | | 15 km/h | 15 km/h |
|
||||||
|
| primary | 30 | 2 | | 34 km/h | 34 km/h |
|
||||||
|
|
||||||
|
@ -412,11 +412,13 @@ function way_function (way, result)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local is_bidirectional = result.forward_mode ~= 0 and result.backward_mode ~= 0
|
||||||
|
|
||||||
-- scale speeds to get better avg driving times
|
-- scale speeds to get better avg driving times
|
||||||
if result.forward_speed > 0 then
|
if result.forward_speed > 0 then
|
||||||
local scaled_speed = result.forward_speed*speed_reduction + 11;
|
local scaled_speed = result.forward_speed*speed_reduction + 11;
|
||||||
local penalized_speed = math.huge
|
local penalized_speed = math.huge
|
||||||
if width <= 3 or lanes <= 1 then
|
if width <= 3 or (lanes <= 1 and is_bidirectional) then
|
||||||
penalized_speed = result.forward_speed / 2;
|
penalized_speed = result.forward_speed / 2;
|
||||||
end
|
end
|
||||||
result.forward_speed = math.min(penalized_speed, scaled_speed)
|
result.forward_speed = math.min(penalized_speed, scaled_speed)
|
||||||
@ -425,7 +427,7 @@ function way_function (way, result)
|
|||||||
if result.backward_speed > 0 then
|
if result.backward_speed > 0 then
|
||||||
local scaled_speed = result.backward_speed*speed_reduction + 11;
|
local scaled_speed = result.backward_speed*speed_reduction + 11;
|
||||||
local penalized_speed = math.huge
|
local penalized_speed = math.huge
|
||||||
if width <= 3 or lanes <= 1 then
|
if width <= 3 or (lanes <= 1 and is_bidirectional) then
|
||||||
penalized_speed = result.backward_speed / 2;
|
penalized_speed = result.backward_speed / 2;
|
||||||
end
|
end
|
||||||
result.backward_speed = math.min(penalized_speed, scaled_speed)
|
result.backward_speed = math.min(penalized_speed, scaled_speed)
|
||||||
|
Loading…
Reference in New Issue
Block a user