1
- # Areas
1
+ @ page pedestrian_areas Pedestrian Areas
2
2
3
- This OSRM feature provides routing through areas. The area type is configurable.
3
+ @ sa AreaManager
4
4
5
- ## Routing over pedestrian areas
5
+ This OSRM feature provides routing through areas, where people are free to choose their
6
+ path. The main motivation for this feature are areas tagged with ` highway=pedestrian ` ,
7
+ but any other area is configurable.
6
8
7
- Pedestrian areas in OSM are either closed ways or multipolygon relations. Currently OSRM
8
- routes along the perimeter of a closed way area. It does not route over multipolygon
9
- areas at all.
9
+ Areas in OSM are either closed ways or multipolygon relations. Currently OSRM routes
10
+ along the perimeter of a closed way area. It does not route over multipolygon areas at
11
+ all.
10
12
11
13
This feature routes over the inside of the area. It does so by "meshing" the area, ie.
12
14
by creating virtual ways between every two entry points of the area. These new ways
13
15
follow lines of sight, they never go through obstacles in the area.
14
16
15
- This feature is opt-in: To enable it you must define a ` process_relation ` function in
17
+ This feature is opt-in: To enable it you must define a @ ref process_relation function in
16
18
your profile and return it like this:
17
19
18
20
``` lua
@@ -27,8 +29,8 @@ return {
27
29
28
30
You must also keep multipolygon relations, so that you can use the name on the relation
29
31
for turn directions. (Remember that the ways in the relation are untagged.) In your
30
- profile's setup function add or edit the ` relation_types ` sequence to include the type
31
- " multipolygon" :
32
+ profile's setup function add or edit the @ ref relation_types sequence to include the
33
+ type ` multipolygon ` :
32
34
33
35
``` lua
34
36
function setup ()
45
47
46
48
### process_relation(profile, relation, relations)
47
49
48
- The ` process_relation ` function is called for every relation in the input file. If you
49
- want a relation to be meshed, call ` area_manager:relation(relation) ` .
50
+ The @ ref process_relation function is called for every relation in the input file. If
51
+ you want a relation to be meshed, you must call [ area_manager: relation () ] ( @ ref AreaManager:: relation()) .
50
52
51
- Example of a process_relation function :
53
+ Example:
52
54
53
55
``` lua
54
56
function process_relation (profile , relation , relations )
55
- type = relation :get_value_by_key (' type' )
56
- highway = relation :get_value_by_key (' highway' )
57
- if type == ' multipolygon' and highway == ' pedestrian' then
57
+ if relation :has_tag (' type' , ' multipolygon' ) and relation :has_tag (' highway' , ' pedestrian' ) then
58
58
-- register the relation
59
59
area_manager :relation (relation )
60
60
end
63
63
64
64
### process_way(profile, way, result, relations)
65
65
66
- The ` process_way ` function is called for every way in the input file. If you want a
67
- closed way to be meshed, call ` area_manager:way(way) ` . (Note that open ways cannot be
68
- meshed and will be ignored.)
66
+ The @ ref process_way function is called for every way in the input file. If you want a
67
+ closed way to be meshed, call [ area_manager: way () ] ( @ ref AreaManager:: way()) . (Note that
68
+ open ways cannot be meshed and will be ignored.)
69
69
70
70
Multipolygons need some support too. Since the member ways of a multipolygon relation
71
71
are as a rule untagged, you have to copy at least the defining tag (and maybe the name)
72
72
from the relation to the way. OSRM discards untagged ways.
73
73
74
- Example of a process_way function :
74
+ Example:
75
75
76
76
``` lua
77
77
function process_way (profile , way , result , relations )
78
78
...
79
- if way :get_value_by_key (' highway' ) == ' pedestrian' and way :get_value_by_key (' area' ) == ' yes ' then
79
+ if way :has_tag (' highway' , ' pedestrian' ) and way :has_true_tag (' area' ) then
80
80
-- register the way
81
81
area_manager :way (way )
82
82
end
@@ -91,47 +91,3 @@ function process_way(profile, way, result, relations)
91
91
...
92
92
end
93
93
```
94
-
95
- ### area_manager
96
-
97
- A global user type.
98
-
99
- #### area_manager: relation (relation)
100
- Call this function inside ` process_relation() ` to register a relation for meshing. The
101
- relation must be a multipolygon relation.
102
-
103
- Argument | Type | Notes
104
- ---------|-------------|-----------------------------------------------------
105
- relation | OSMRelation | The same relation as passed into ` process_relation ` .
106
-
107
- #### area_manager: way (way)
108
- Call this function inside ` process_way() ` to register a way for meshing. The way must be
109
- closed.
110
-
111
- Argument | Type | Notes
112
- ---------|----------|-------------------------------------------
113
- way | OSMWay | The same way as passed into ` process_way ` .
114
-
115
- #### area_manager: get_relations (node), area_manager: get_relations (way)
116
- Call this functions inside ` process_node() ` and ` process_way() ` respectively. If this
117
- node or way is a member of a relation that was registered for meshing, those relations
118
- will be returned.
119
-
120
- Since the member ways of a multipolygon relation are as a rule untagged, and since OSRM
121
- discards untagged ways, you have to copy at least the defining tag (and maybe the name
122
- tags) from the relation to the way.
123
-
124
- Argument | Type | Notes
125
- ---------|----------|-----------------------------------------------
126
- node | OSMNode | The same node as passed into ` process_node() ` .
127
- way | OSMWay | The same way as passed into ` process_way() ` .
128
-
129
- Usage example:
130
-
131
- ``` lua
132
- for _ , rel_id in pairs (area_manager :get_relations (way )) do
133
- local rel = relations :relation (rel_id )
134
- data .highway = rel :get_value_by_key (' highway' )
135
- WayHandlers .names (profile , rel , result , data )
136
- end
137
- ```
0 commit comments