You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/profiles.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ If you want to prioritize certain streets, increase the rate on these.
71
71
A profile should set `api_version` at the top of your profile. This is done to ensure that older profiles are still supported when the api changes. If `api_version` is not defined, 0 will be assumed. The current api version is 4.
72
72
73
73
### Library files
74
-
The folder [profiles/lib/](../profiles/lib/) contains LUA library files for handling many common processing tasks.
74
+
The folder [profiles/lib/](../profiles/lib/) contains Lua library files for handling many common processing tasks.
75
75
76
76
File | Notes
77
77
------------------|------------------------------
@@ -89,7 +89,7 @@ They all return a table of functions when you use `require` to load them. You ca
89
89
### setup()
90
90
The `setup` function is called once when the profile is loaded and must return a table of configurations. It's also where you can do other global setup, like loading data sources that are used during processing.
91
91
92
-
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA interpreter will have its own set of globals.
92
+
Note that processing of data is parallelized and several unconnected Lua interpreters will be running at the same time. The `setup` function will be called once for each. Each Lua interpreter will have its own set of globals.
93
93
94
94
The following global properties can be set under `properties` in the hash you return in the `setup` function:
95
95
@@ -347,10 +347,34 @@ road_classification.road_priority_class | Enum | Guidance: order in priority
347
347
road_classification.may_be_ignored | Boolean | Guidance: way is non-highway
348
348
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
349
349
350
+
### Way names
351
+
The `WayHandlers.names` function in [way_handlers.lua](../profiles/lib/way_handlers.lua) handles extraction of way names for routing instructions. It processes the following OSM tags:
`name:pronunciation` | Pronunciation hint for text-to-speech
357
+
`ref` | Road reference number (e.g., "A1", "I-95")
358
+
`junction:ref` | Exit or junction reference number
359
+
360
+
For unnamed sidewalks and sidepaths (where `highway=footway`, `highway=cycleway`, or `highway=path`), the function also supports fallback name tags when the way is marked as a sidepath:
`is_sidepath:of:name` | Name of the street the sidepath follows (checked first)
365
+
`street:name` | Alternative tag for the associated street name
366
+
367
+
The fallback is only applied when the way has one of these sidepath markers:
368
+
-`footway=sidewalk`
369
+
-`cycleway=sidepath`
370
+
-`is_sidepath=yes`
371
+
372
+
This allows routing instructions to show street names for separately mapped sidewalks, e.g., "Turn right onto Main Street" instead of just "Turn right".
373
+
350
374
### process_segment(profile, segment)
351
375
The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes.
352
376
353
-
On OpenStreetMap way cannot have different tags on different parts of a way. Instead you would split the way into several smaller ways. However many ways are long. For example, many ways pass hills without any change in tags.
377
+
An OpenStreetMap way cannot have different tags on different parts of a way. Instead you would split the way into several smaller ways. However, many ways are long. For example, many ways pass over hills without any change in tags.
354
378
355
379
Processing each segment of an OSM way makes it possible to have different speeds on different parts of a way based on external data like data about elevation, pollution, noise or scenic value and adjust weight and duration of the segment accordingly.
356
380
@@ -453,10 +477,10 @@ When turning from `a` to `b` via `x`,
453
477
*`roads_on_the_left[1]` is the road `xe`
454
478
*`roads_on_the_left[2]` is the road `xc`
455
479
456
-
Note that indices of arrays in lua are 1-based.
480
+
Note that indices of arrays in Lua are 1-based.
457
481
458
482
#### `highway_turn_classification` and `access_turn_classification`
459
-
When setting appropriate turn weights and duration, information about the highway and access tags of roads that are involved in the turn are necessary. The lua turn function `process_turn` does not have access to the original osrm tags anymore. However, `highway_turn_classification` and `access_turn_classification` can be set during setup. The classification set during setup can be later used in `process_turn`.
483
+
When setting appropriate turn weights and duration, information about the highway and access tags of roads that are involved in the turn are necessary. The Lua turn function `process_turn` does not have access to the original OSM tags anymore. However, `highway_turn_classification` and `access_turn_classification` can be set during setup. The classification set during setup can be later used in `process_turn`.
460
484
461
485
**Example**
462
486
@@ -513,7 +537,7 @@ function setup()
513
537
end
514
538
```
515
539
516
-
The input data must an ASCII file with rows of integers. e.g.:
540
+
The input data must be an ASCII file with rows of integers, e.g.:
0 commit comments