diff --git a/CHANGELOG.md b/CHANGELOG.md index f98d7fb9d..fb72e4554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/features/car/classes.feature b/features/car/classes.feature index e8ad41785..384a61acd 100644 --- a/features/car/classes.feature +++ b/features/car/classes.feature @@ -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 @@ -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 """ diff --git a/profiles/car.lua b/profiles/car.lua index f4467d596..04d24eba6 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -104,7 +104,7 @@ function setup() }, classes = Sequence { - 'toll', 'motorway', 'ferry', 'restricted' + 'toll', 'motorway', 'ferry', 'restricted', 'tunnel' }, -- classes to support for exclude flags diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua index 1c4294066..99fcf6d11 100644 --- a/profiles/lib/way_handlers.lua +++ b/profiles/lib/way_handlers.lua @@ -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 diff --git a/test/nodejs/constants.js b/test/nodejs/constants.js index f1e85c5fd..796009ee7 100644 --- a/test/nodejs/constants.js +++ b/test/nodejs/constants.js @@ -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