Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tunnel as a class in lua #4812

Merged
merged 1 commit into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- FIXED #4781: Fixed overflow exceptions in percent-encoding parsing
- Guidance:
- CHANGED #4706: Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation [#4706](https://github.com/Project-OSRM/osrm-backend/pull/4706)
- Profile:
- ADDED: `tunnel` as a new class in car profile so that sections of the route with tunnel tags will be marked as such

# 5.14.3
- Changes from 5.14.2:
Expand Down
22 changes: 21 additions & 1 deletion features/car/classes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Feature: Car - Mode flag
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] |

Scenario: Car - We toll restricted with a class
Scenario: Car - We tag toll with a class
Given the node map
"""
a b
Expand All @@ -99,6 +99,26 @@ Feature: Car - Mode flag
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive | [(toll),(motorway,toll),()],[()] |

Scenario: Car - We tag tunnel with a class
Background:
Given a grid size of 200 meters

Given the node map
"""
a b
c d
"""

And the ways
| nodes | tunnel |
| ab | no |
| bc | yes |
| cd | |

When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd,cd | depart,new name right,new name left,arrive | [()],[(tunnel)],[()],[()] |

Scenario: Car - From roundabout on toll road
Given the node map
"""
Expand Down
2 changes: 1 addition & 1 deletion profiles/car.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function setup()
},

classes = Sequence {
'toll', 'motorway', 'ferry', 'restricted'
'toll', 'motorway', 'ferry', 'restricted', 'tunnel'
},

-- classes to support for exclude flags
Expand Down
6 changes: 6 additions & 0 deletions profiles/lib/way_handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ end
function WayHandlers.classes(profile,way,result,data)
local forward_toll, backward_toll = Tags.get_forward_backward_by_key(way, data, "toll")
local forward_route, backward_route = Tags.get_forward_backward_by_key(way, data, "route")
local tunnel = way:get_value_by_key("tunnel")

if tunnel and tunnel ~= "no" then
result.forward_classes["tunnel"] = true
result.backward_classes["tunnel"] = true
end

if forward_toll == "yes" then
result.forward_classes["toll"] = true
Expand Down
2 changes: 1 addition & 1 deletion test/nodejs/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports.three_test_coordinates = [[7.41337, 43.72956],

exports.two_test_coordinates = exports.three_test_coordinates.slice(0, 2)

exports.test_tile = {'at': [17059, 11948, 15], 'size': 168606};
exports.test_tile = {'at': [17059, 11948, 15], 'size': 169239};


// Test files generated by the routing engine; check test/data
Expand Down