Skip to content

Commit 4ea1444

Browse files
authored
feat: conveying tag for escalators and moving walkways (#7466)
1 parent 43d68f3 commit 4ea1444

3 files changed

Lines changed: 195 additions & 0 deletions

File tree

features/foot/conveying.feature

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
@routing @foot @conveying
2+
Feature: Foot - Conveying tag on escalators and moving walkways
3+
# Reference: https://wiki.openstreetmap.org/wiki/Key:conveying
4+
5+
Background:
6+
Given the profile "foot"
7+
Given a grid size of 10 meters
8+
9+
Scenario: Foot - Escalator with conveying=forward: only traversable in forward direction
10+
Given the node map
11+
"""
12+
a b c
13+
"""
14+
15+
And the ways
16+
| nodes | highway | conveying |
17+
| abc | steps | forward |
18+
19+
When I route I should get
20+
| from | to | route | time |
21+
| a | c | abc,abc | 14.4s |
22+
23+
When I route I should get
24+
| from | to | status |
25+
| c | a | 400 |
26+
27+
Scenario: Foot - Escalator with conveying=backward: only traversable in backward direction
28+
Given the node map
29+
"""
30+
a b c
31+
"""
32+
33+
And the ways
34+
| nodes | highway | conveying |
35+
| abc | steps | backward |
36+
37+
When I route I should get
38+
| from | to | route | time |
39+
| c | a | abc,abc | 14.4s |
40+
41+
When I route I should get
42+
| from | to | status |
43+
| a | c | 400 |
44+
45+
Scenario: Foot - Escalator with conveying=reversible: equal time both ways
46+
Given the node map
47+
"""
48+
a b c
49+
"""
50+
51+
And the ways
52+
| nodes | highway | conveying |
53+
| abc | steps | reversible |
54+
55+
When I route I should get
56+
| from | to | route | time |
57+
| a | c | abc,abc | 14.4s |
58+
| c | a | abc,abc | 14.4s |
59+
60+
Scenario: Foot - Moving walkway with conveying=forward: only traversable in forward direction
61+
Given the node map
62+
"""
63+
a b c
64+
"""
65+
66+
And the ways
67+
| nodes | highway | conveying |
68+
| abc | footway | forward |
69+
70+
When I route I should get
71+
| from | to | route | time |
72+
| a | c | abc,abc | 14.4s |
73+
74+
When I route I should get
75+
| from | to | status |
76+
| c | a | 400 |
77+
78+
Scenario: Foot - No conveying tag: equal time both directions
79+
Given the node map
80+
"""
81+
a b c
82+
"""
83+
84+
And the ways
85+
| nodes | highway |
86+
| abc | steps |
87+
88+
When I route I should get
89+
| from | to | route | time |
90+
| a | c | abc,abc | 14.4s |
91+
| c | a | abc,abc | 14.4s |
92+
93+
Scenario: Foot - Conveying=yes without direction: equal time both directions
94+
Given the node map
95+
"""
96+
a b c
97+
"""
98+
99+
And the ways
100+
| nodes | highway | conveying |
101+
| abc | steps | yes |
102+
103+
When I route I should get
104+
| from | to | route | time |
105+
| a | c | abc,abc | 14.4s |
106+
| c | a | abc,abc | 14.4s |
107+
108+
Scenario: Foot - Conveying tag ignored on non-escalator highways: equal time both directions
109+
Given the node map
110+
"""
111+
a b c
112+
"""
113+
114+
And the ways
115+
| nodes | highway | conveying |
116+
| abc | residential | forward |
117+
118+
When I route I should get
119+
| from | to | route | time |
120+
| a | c | abc,abc | 14.4s |
121+
| c | a | abc,abc | 14.4s |
122+
123+
Scenario: Foot - Escalator with oneway=no allows bidirectional travel
124+
Given the node map
125+
"""
126+
a b c
127+
"""
128+
129+
And the ways
130+
| nodes | highway | conveying | oneway |
131+
| abc | steps | forward | no |
132+
133+
When I route I should get
134+
| from | to | route | time |
135+
| a | c | abc,abc | 14.4s |
136+
| c | a | abc,abc | 14.4s |
137+
138+
Scenario: Foot - Prefer escalator with favorable conveying direction
139+
Given the node map
140+
"""
141+
a b c
142+
d e f
143+
"""
144+
145+
And the ways
146+
| nodes | highway | conveying |
147+
| ad | footway | |
148+
| de | footway | |
149+
| ef | footway | |
150+
| abc | steps | forward |
151+
152+
When I route I should get
153+
| from | to | route |
154+
| a | c | abc,abc |
155+
156+
When I route I should get
157+
| from | to | status |
158+
| c | a | 400 |

profiles/foot.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ function process_way(profile, way, result)
273273
WayHandlers.speed,
274274
WayHandlers.surface,
275275

276+
-- handle conveying tag on escalators and moving walkways
277+
WayHandlers.conveying,
278+
276279
-- handle turn lanes and road classification, used for guidance
277280
WayHandlers.classification,
278281

profiles/lib/way_handlers.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,40 @@ function WayHandlers.driving_side(profile, way, result, data)
734734
end
735735
end
736736

737+
-- Handle conveying tag on escalators and moving walkways
738+
-- The conveying tag indicates the direction of movement on a conveyor device
739+
-- Only applies to highway=steps (escalators) and highway=footway (moving walkways)
740+
-- conveying=forward: movement in way direction only (block backward unless oneway=no)
741+
-- conveying=backward: movement opposite to way direction only (block forward unless oneway=no)
742+
-- conveying=reversible: movement can go either direction
743+
-- Escalators and moving walkways are directional and block travel in the opposite direction
744+
function WayHandlers.conveying(profile, way, result, data)
745+
local conveying = way:get_value_by_key("conveying")
746+
747+
if not conveying or conveying == "yes" or conveying == "reversible" then
748+
return
749+
end
750+
751+
local highway = data.highway
752+
if highway ~= "steps" and highway ~= "footway" then
753+
return
754+
end
755+
756+
local oneway = data.oneway or way:get_value_by_key("oneway")
757+
local allow_reverse = oneway == "no"
758+
if conveying == "forward" then
759+
-- Block backward travel unless explicitly allowed by oneway=no
760+
if not allow_reverse then
761+
result.backward_mode = mode.inaccessible
762+
end
763+
elseif conveying == "backward" then
764+
-- Block forward travel unless explicitly allowed by oneway=no
765+
if not allow_reverse then
766+
result.forward_mode = mode.inaccessible
767+
end
768+
end
769+
end
770+
737771

738772
-- Call a sequence of handlers, aborting in case a handler returns false. Example:
739773
--

0 commit comments

Comments
 (0)