Fix assertions in car profile, resolves #3629

restrict direction if access tag is missing and can not be derived
from highway tag

http://www.openstreetmap.org/way/4282676
http://www.openstreetmap.org/way/4621857
http://www.openstreetmap.org/way/4898368
This commit is contained in:
Michael Krasnyk 2017-01-31 12:57:04 +01:00 committed by Patrick Niklaus
parent eaed5c7a8e
commit 1628ebb871
4 changed files with 41 additions and 19 deletions

View File

@ -245,3 +245,14 @@ Feature: Car - Restricted access
| gate | designated | x | | gate | designated | x |
| gate | private | | | gate | private | |
| gate | garbagetag | x | | gate | garbagetag | x |
Scenario: Car - a way with conditional access
Then routability should be
| highway | vehicle:forward | vehicle:backward:conditional | forw | backw |
| pedestrian | yes | delivery @ (20:00-11:00) | x | |
Scenario: Car - a way with a list of tags
Then routability should be
| highway | motor_vehicle | motor_vehicle:forward | motor_vehicle:backward | forw | backw |
| footway | | | destination | | x |
| track | destination;agricultural | destination | | x | x |

View File

@ -103,3 +103,8 @@ Feature: Foot - Access tags on ways
| bridleway | | yes | | | | bridleway | | yes | | |
| bridleway | designated | | | | | bridleway | designated | | | |
| bridleway | | | | | | bridleway | | | | |
Scenario: Foot - a way with missing :forward tag
Then routability should be
| highway | bicycle:backward | foot:backward | forw | backw |
| cycleway | designated | designated | | x |

View File

@ -215,18 +215,24 @@ function Handlers.handle_speed(way,result,data,profile)
if speed then if speed then
-- set speed by way type -- set speed by way type
result.forward_speed = highway_speed
result.backward_speed = highway_speed
result.forward_speed = speed result.forward_speed = speed
result.backward_speed = speed result.backward_speed = speed
else else
-- Set the avg speed on ways that are marked accessible -- Set the avg speed on ways that are marked accessible
if profile.access_tag_whitelist[data.forward_access] then if profile.access_tag_whitelist[data.forward_access] then
result.forward_speed = profile.default_speed result.forward_speed = profile.default_speed
elseif data.forward_access and not profile.access_tag_blacklist[data.forward_access] then
result.forward_speed = profile.default_speed -- fallback to the avg speed if access tag is not blacklisted
elseif not data.forward_access and data.backward_access then
result.forward_mode = mode.inaccessible
end end
if profile.access_tag_whitelist[data.backward_access] then if profile.access_tag_whitelist[data.backward_access] then
result.backward_speed = profile.default_speed result.backward_speed = profile.default_speed
elseif data.backward_access and not profile.access_tag_blacklist[data.backward_access] then
result.backward_speed = profile.default_speed -- fallback to the avg speed if access tag is not blacklisted
elseif not data.backward_access and data.forward_access then
result.backward_mode = mode.inaccessible
end end
end end