Skip to content

Commit b6db39e

Browse files
deniskoronchikPatrick Niklaus
authored andcommitted
Update documentation
1 parent d22b379 commit b6db39e

File tree

1 file changed

+4
-52
lines changed

1 file changed

+4
-52
lines changed

docs/profiles.md

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ max_speed_for_map_matching | Float | Maximum vehicle speed to be as
104104
max_turn_weight | Float | Maximum turn penalty weight
105105
force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that `process_segment` will be called for all segments (default `false`)
106106

107+
107108
The following additional global properties can be set in the hash you return in the `setup` function:
108109

109110
Attribute | Type | Notes
@@ -113,6 +114,7 @@ excludable | Sequence of Sets | Determines which class
113114
classes | Sequence | Determines the allowed classes that can be referenced using `{forward,backward}_classes` on the way in the `process_way` function.
114115
restrictions | Sequence | Determines which turn restrictions will be used for this profile.
115116
suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES".
117+
relation_types | Sequence | Determines wich relations should be cached for processing in this profile. It contains relations types
116118

117119
### process_node(profile, node, result, relations)
118120
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
@@ -122,7 +124,7 @@ Argument | Description
122124
profile | The configuration table you returned in `setup`.
123125
node | The input node to process (read-only).
124126
result | The output that you will modify.
125-
relations| The list of relation attributes passed from `process_relation` function for this node.
127+
relations| Storage of relations to access relations, where `node` is a member.
126128

127129
The following attributes can be set on `result`:
128130

@@ -139,7 +141,7 @@ Argument | Description
139141
profile | The configuration table you returned in `setup`.
140142
node | The input way to process (read-only).
141143
result | The output that you will modify.
142-
relations| The list of relation attributes passed from `process_relation` function for this way.
144+
relations| Storage of relations to access relations, where `way` is a member.
143145

144146
Importantly it will set `result.forward_mode` and `result.backward_mode` to indicate the travel mode in each direction, as well as set `result.forward_speed` and `result.backward_speed` to integer values representing the speed for traversing the way.
145147

@@ -179,56 +181,6 @@ road_classification.road_priority_class | Enum | Guidance: order in priority
179181
road_classification.may_be_ignored | Boolean | Guidance: way is non-highway
180182
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
181183

182-
### process_relation(profile, relation, result)
183-
184-
Supported since API **version 3**.
185-
186-
Given an OpenStreetMap relation, the `process_relation` function should setup values into result structure.
187-
188-
Argument | Description
189-
---------|-------------------------------------------------------
190-
profile | The configuration table you returned in `setup`.
191-
node | The input relation to process (read-only).
192-
result | The output that you will modify.
193-
194-
Relation process work flow consist of next steps:
195-
1. Calls `process_relation` function for each relation. It should fill a `result` structure
196-
2. After that each data will be passed for each member of processed relation into `process_node` and `process_way` functions
197-
198-
The following attributes can be set on that result in `process_relation`:
199-
200-
Attribute | Type | Notes
201-
----------------------------------------|----------|--------------------------------------------------------------------------
202-
is_restriction | Boolean | Flag to determine if relation is a turn restriction
203-
204-
Example processing code:
205-
```lua
206-
207-
function process_way(profile, way, result, relations)
208-
for _, r in ipairs(relations) do
209-
for k, v in pairs(r) do
210-
print('data_' .. k .. '_value_' .. v)
211-
end
212-
end
213-
print ('process_way ' .. way:id() .. ' ' .. result.name)
214-
end
215-
216-
function process_relation(profile, relation, result)
217-
local t = relation:get_value_by_key("type")
218-
if t == "route" then
219-
for _, m in ipairs(relation:members()) do
220-
if m:role == "north" then
221-
result[m]['direction'] = 'north'
222-
print('direction_north')
223-
end
224-
end
225-
226-
print('route_relation')
227-
end
228-
end
229-
```
230-
231-
232184
### process_segment(profile, segment)
233185
The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes.
234186

0 commit comments

Comments
 (0)