Skip to content

Commit ecd5eb3

Browse files
committed
Add a section on the new fallback implementation and fix typos
1 parent 81b8b60 commit ecd5eb3

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

docs/profiles.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ If you want to prioritize certain streets, increase the rate on these.
7171
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.
7272

7373
### 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.
7575

7676
File | Notes
7777
------------------|------------------------------
@@ -89,7 +89,7 @@ They all return a table of functions when you use `require` to load them. You ca
8989
### setup()
9090
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.
9191

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.
9393

9494
The following global properties can be set under `properties` in the hash you return in the `setup` function:
9595

@@ -347,10 +347,34 @@ road_classification.road_priority_class | Enum | Guidance: order in priority
347347
road_classification.may_be_ignored | Boolean | Guidance: way is non-highway
348348
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
349349

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:
352+
353+
Tag | Notes
354+
----------------------|------------------------------
355+
`name` | Primary name of the way
356+
`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:
361+
362+
Tag | Notes
363+
----------------------|------------------------------
364+
`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+
350374
### process_segment(profile, segment)
351375
The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes.
352376

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.
354378

355379
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.
356380

@@ -453,10 +477,10 @@ When turning from `a` to `b` via `x`,
453477
* `roads_on_the_left[1]` is the road `xe`
454478
* `roads_on_the_left[2]` is the road `xc`
455479

456-
Note that indices of arrays in lua are 1-based.
480+
Note that indices of arrays in Lua are 1-based.
457481

458482
#### `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`.
460484

461485
**Example**
462486

@@ -513,7 +537,7 @@ function setup()
513537
end
514538
```
515539

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.:
517541

518542
```
519543
0 0 0 0

0 commit comments

Comments
 (0)