Skip to content

Commit a264ce0

Browse files
authored
fix(docs): make docs deployable to subdir (#7479)
1 parent 913dfe3 commit a264ce0

8 files changed

Lines changed: 187 additions & 30 deletions

File tree

docs/.vitepress/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default defineConfig({
77
title: 'OSRM API Documentation',
88
description: 'The Open Source Routing Machine API documentation',
99
base: docsBase,
10+
cleanUrls: true,
1011
ignoreDeadLinks: true,
1112

1213
themeConfig: {
@@ -20,7 +21,7 @@ export default defineConfig({
2021
{
2122
text: 'Getting Started',
2223
items: [
23-
{ text: 'Introduction', link: '/' },
24+
{ text: 'Tool options', link: '/tools'},
2425
{ text: 'Developing', link: '/developing' },
2526
{ text: 'Testing', link: '/testing' },
2627
{ text: 'Releasing', link: '/releasing' }

docs/cucumber.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This documentation describes the technical aspects of our cucumber test suite.
1111
Run the Cucumber tests with:
1212

1313
``` bash
14-
$ npm test -- --parallel 16
14+
$ npm test
1515
```
1616

1717
## Single OSRM Configuration
@@ -74,7 +74,7 @@ configured port number (eg. at ports 5000--5000+N).
7474
We provide a shortcut to run all 6 configurations:
7575

7676
``` bash
77-
$ npm test -- --parallel 16
77+
$ npm test
7878
```
7979
This is how the tests are run on the CI server. You can pass the same arguments as
8080
mentioned above.
@@ -129,7 +129,7 @@ arbitrarily although it is best to conform to the tags already used. Eg. the tag
129129
`@guidance` can be used to run only those tests related to the guidance feature:
130130

131131
``` bash
132-
$ npm test -- --parallel 16 --tags @guidance
132+
$ npm test -- --tags @guidance
133133
```
134134

135135
We also support following special tags:

docs/developing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The field `data-for-conversion` can be an arbitrary long set of features and nee
2626

2727
The policy itself offers a `operator()` accepting a `vector` of `NodeID`.
2828

29-
For outputting data into our file (debug.geojson), we simply need to call the matching logging routine of the guard: `util::ScioedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);`
29+
For outputting data into our file (debug.geojson), we simply need to call the matching logging routine of the guard: `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);`
3030
(or `guard.Write(list_of_node_ids)` if you created an instance).
3131

3232
### Possible Scopeguard Location
@@ -57,6 +57,6 @@ If we want to use the same policy for multiple files, we need to use different t
5757

5858
as well as,
5959

60-
`util::ScopedGeojsonLoggerGuardr<util::NodeIdVectorToLineString,0>::Write(list_of_node_ids);`
60+
`util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString,0>::Write(list_of_node_ids);`
6161

62-
`util::ScopedGeojsonLoggerGuardr<util::NodeIdVectorToLineString,1>::Write(list_of_node_ids);`
62+
`util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString,1>::Write(list_of_node_ids);`

docs/http.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ curl 'http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?numb
188188
"location" : [
189189
13.388775,
190190
52.51717
191-
],
191+
]
192192
}
193193
],
194194
"code" : "Ok"
@@ -476,7 +476,7 @@ The returned path does not have to be the fastest one. As TSP is NP-hard it only
476476
Note that all input coordinates have to be connected for the trip service to work.
477477

478478
```endpoint
479-
GET /trip/v1/{profile}/{coordinates}?roundtrip={true|false}&source{any|first}&destination{any|last}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={simplified|full|false}&annotations={true|false}'
479+
GET /trip/v1/{profile}/{coordinates}?roundtrip={true|false}&source={any|first}&destination={any|last}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={simplified|full|false}&annotations={true|false}
480480
```
481481

482482
In addition to the [general options](#general-options) the following options are supported for this service:

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ hero:
1515
- theme: alt
1616
text: View on GitHub
1717
link: https://github.com/Project-OSRM/osrm-backend
18+
- theme: alt
19+
text: Sponsor ❤
20+
link: https://github.com/sponsors/Project-OSRM
1821

1922
features:
2023
- icon: 🚗

docs/testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ OSRM comes with a testsuite containing both unit-tests using the Boost library a
44

55
## Unit Tests
66

7-
For a general introduction on Boost.Test have a look at [its docs](http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/index.html).
7+
For a general introduction on Boost.Test have a look at [its docs](https://www.boost.org/doc/libs/release/libs/test/doc/html/index.html).
88

99
### Separate Test Binaries
1010

@@ -15,8 +15,8 @@ See `CMakeLists.txt` in the unit test directory for how to register new unit tes
1515
### Using Boost.Test Primitives
1616

1717
There is a difference between only reporting a failed condition and aborting the test right at a failed condition.
18-
Have a look at [`BOOST_CHECK` vs `BOOST_REQUIRE`](http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level.html).
19-
Instead of manually checking e.g. for equality, less than, if a function throws etc. use their [corresponding Boost.Test primitives](http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref.html).
18+
Have a look at [`BOOST_CHECK` vs `BOOST_REQUIRE`](https://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level.html).
19+
Instead of manually checking e.g. for equality, less than, if a function throws etc. use their [corresponding Boost.Test primitives](https://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref.html).
2020

2121
If you use `BOOST_CHECK_EQUAL` you have to implement `operator<<` for your type so that Boost.Test can print mismatches.
2222
If you do not want to do this, define `BOOST_TEST_DONT_PRINT_LOG_VALUE` (and undef it after the check call) or sidestep it with `BOOST_CHECK(fst == snd);`.

docs/tools.md

Lines changed: 165 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
# Common Tool Options
1+
# Command-Line Tools
22

3-
These options are available for all OSRM command-line tools:
4-
`osrm-extract`, `osrm-partition`, `osrm-customize`, `osrm-contract`, `osrm-routed`, and `osrm-datastore`.
3+
OSRM ships six command-line tools that cover the full data pipeline, from raw
4+
OSM data to a running routing server. All tools share a set of common options
5+
described below, followed by per-tool reference sections.
56

6-
## --list-inputs
7+
## Common Options
78

8-
Lists all required and optional input file extensions that the tool expects.
9-
Useful for deployment scripts that need to know which files to copy.
10-
Duplicate entries are suppressed when a tool combines multiple configs.
9+
These flags are accepted by every tool.
10+
11+
| Flag | Short | Description |
12+
|------|-------|-------------|
13+
| `--help` | `-h` | Show the help message and exit. |
14+
| `--version` | `-v` | Show the version string and exit. |
15+
| `--verbosity <level>` | `-l` | Log verbosity: `NONE`, `ERROR`, `WARNING`, `INFO` (default), `DEBUG`. |
16+
| `--list-inputs` | | Print all required and optional input file extensions the tool expects, then exit. Useful for deployment scripts. |
17+
| `--threads <n>` | `-t` | Number of threads to use (default: number of logical CPUs). |
18+
19+
### `--list-inputs`
20+
21+
Prints one line per file in the format `required|optional <extension>`:
1122

12-
Example:
1323
```
1424
$ osrm-routed --list-inputs
1525
required .osrm.datasource_names
@@ -20,19 +30,157 @@ optional .osrm.hsgr
2030
optional .osrm.cells
2131
```
2232

23-
```
24-
$ osrm-extract --list-inputs
25-
required .osrm.ebg
26-
required .osrm.ebg_nodes
27-
...
28-
```
29-
30-
The output format is one line per file: `required|optional <extension>`.
31-
A deployment script can use this to determine the exact set of files needed:
33+
Example — collect all files needed to deploy `osrm-routed`:
3234

3335
```bash
3436
BASE=map
3537
for line in $(osrm-routed --list-inputs); do
3638
echo "$BASE$line"
3739
done
3840
```
41+
42+
---
43+
44+
## osrm-extract
45+
46+
Reads an OSM file and a Lua profile, and produces the intermediate `.osrm.*`
47+
files consumed by the graph-preparation tools.
48+
49+
```
50+
osrm-extract <input.osm/.osm.bz2/.osm.pbf> [options]
51+
```
52+
53+
| Flag | Short | Default | Description |
54+
|------|-------|---------|-------------|
55+
| `--profile <path>` | `-p` | `profiles/car.lua` | Path to the Lua routing profile. |
56+
| `--output <path>` | `-o` | Derived from input filename | Base path for generated output files. |
57+
| `--data_version <string>` | `-d` | _(none)_ | Tag the dataset with a version string. Use `osmosis` to read the timestamp embedded in the PBF file. |
58+
| `--small-component-size <n>` | | `1000` | Minimum node count for a strongly-connected component to be treated as "large". Affects nearest-neighbor snapping. |
59+
| `--with-osm-metadata` | | | Parse OSM metadata (user, timestamp, etc.). May reduce extraction performance. |
60+
| `--parse-conditional-restrictions` | | | Save conditional turn restrictions to disk so they can be evaluated during contraction. |
61+
| `--location-dependent-data <file>` | | | GeoJSON files containing location-dependent data (e.g. speed limits by region). Repeatable. |
62+
| `--disable-location-cache` | | | Disable the internal node-location cache used for location-dependent data lookups. |
63+
| `--dump-nbg-graph` | | | Write the raw node-based graph to the `.osrm` file for debugging. |
64+
65+
---
66+
67+
## osrm-partition
68+
69+
Partitions the road network graph into a hierarchy of cells used by the
70+
Multi-Level Dijkstra (MLD) algorithm.
71+
72+
```
73+
osrm-partition <input.osrm> [options]
74+
```
75+
76+
| Flag | Default | Description |
77+
|------|---------|-------------|
78+
| `--max-cell-sizes <list>` | `128,4096,65536,2097152` | Comma-separated maximum cell sizes per level, starting from level 1. The first value is also the bisection termination threshold. |
79+
| `--balance <factor>` | `1.2` | Maximum allowed size ratio between the two sides of a single bisection. |
80+
| `--boundary <fraction>` | `0.25` | Fraction of nodes to use as boundary sources/sinks during contraction. |
81+
| `--optimizing-cuts <n>` | `10` | Number of candidate cuts evaluated when optimizing a single bisection. |
82+
| `--small-component-size <n>` | `1000` | Node-count threshold below which a component is treated as small. |
83+
84+
---
85+
86+
## osrm-customize
87+
88+
Applies live traffic data (speed and turn-penalty files) to a partitioned MLD
89+
graph. Can be run repeatedly without re-partitioning when speeds change.
90+
91+
```
92+
osrm-customize <input.osrm> [options]
93+
```
94+
95+
| Flag | Default | Description |
96+
|------|---------|-------------|
97+
| `--segment-speed-file <file>` | | CSV with `nodeA,nodeB,speed` columns to override edge weights. Repeatable. |
98+
| `--turn-penalty-file <file>` | | CSV with `from_node,via_node,to_node,penalty` to override turn weights. Repeatable. |
99+
| `--edge-weight-updates-over-factor <x>` | `0` (disabled) | Log edges whose weight changed by more than factor `x` (requires `--segment-speed-file`). |
100+
| `--parse-conditionals-from-now <utc_timestamp>` | `0` (disabled) | UTC Unix timestamp from which to evaluate conditional turn restrictions. |
101+
| `--time-zone-file <file>` | | GeoJSON file with time-zone boundaries, required for conditional restriction parsing. |
102+
103+
---
104+
105+
## osrm-contract
106+
107+
Builds a Contraction Hierarchy (CH) from the extracted graph. Use this instead
108+
of `osrm-partition` + `osrm-customize` when you don't need live traffic updates.
109+
110+
```
111+
osrm-contract <input.osrm> [options]
112+
```
113+
114+
| Flag | Default | Description |
115+
|------|---------|-------------|
116+
| `--segment-speed-file <file>` | | CSV with `nodeA,nodeB,speed` columns to override edge weights. Repeatable. |
117+
| `--turn-penalty-file <file>` | | CSV with `from_node,via_node,to_node,penalty` to override turn weights. Repeatable. |
118+
| `--edge-weight-updates-over-factor <x>` | `0` (disabled) | Log edges whose weight changed by more than factor `x`. |
119+
| `--parse-conditionals-from-now <utc_timestamp>` | `0` (disabled) | UTC Unix timestamp for evaluating conditional turn restrictions. |
120+
| `--time-zone-file <file>` | | GeoJSON file with time-zone boundaries, required for conditional restriction parsing. |
121+
122+
---
123+
124+
## osrm-routed
125+
126+
The HTTP server. Loads a prepared dataset and serves the OSRM HTTP API.
127+
128+
```
129+
osrm-routed <base.osrm> [options]
130+
```
131+
132+
### Server
133+
134+
| Flag | Short | Default | Description |
135+
|------|-------|---------|-------------|
136+
| `--ip <address>` | `-i` | `0.0.0.0` | IP address to listen on. |
137+
| `--port <n>` | `-p` | `5000` | TCP port to listen on. |
138+
| `--keepalive-timeout <s>` | `-k` | `5` | HTTP keep-alive timeout in seconds. |
139+
| `--trial` | | | Start up fully, then exit immediately. Useful to validate a dataset without serving traffic. |
140+
141+
### Data loading
142+
143+
| Flag | Short | Default | Description |
144+
|------|-------|---------|-------------|
145+
| `--algorithm <name>` | `-a` | `CH` | Routing algorithm: `CH` (Contraction Hierarchy) or `MLD` (Multi-Level Dijkstra). |
146+
| `--shared-memory` | `-s` | off | Load data from a shared memory region managed by `osrm-datastore`. |
147+
| `--mmap` | `-m` | off | Memory-map the data files instead of loading them into RAM. |
148+
| `--dataset-name <name>` | | | Shared memory dataset name to connect to (used with `--shared-memory`). |
149+
| `--disable-feature-dataset <name>` | | | Skip loading an optional dataset to save memory. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`. |
150+
151+
### Query limits
152+
153+
| Flag | Default | Description |
154+
|------|---------|-------------|
155+
| `--max-viaroute-size <n>` | `500` | Maximum number of waypoints in a route query. |
156+
| `--max-trip-size <n>` | `100` | Maximum number of locations in a trip query. |
157+
| `--max-table-size <n>` | `100` | Maximum number of locations in a table query. |
158+
| `--max-matching-size <n>` | `100` | Maximum number of locations in a map-matching query. |
159+
| `--max-nearest-size <n>` | `100` | Maximum number of results in a nearest query. |
160+
| `--max-alternatives <n>` | `3` | Maximum number of alternative routes (MLD only). |
161+
| `--max-matching-radius <m>` | `-1` (unlimited) | Maximum search radius in metres for map-matching. |
162+
| `--default-radius <m>` | `-1` (unlimited) | Default snap radius for all queries. |
163+
| `--max-header-size <bytes>` | `0` (auto) | Maximum HTTP header size in bytes. |
164+
165+
---
166+
167+
## osrm-datastore
168+
169+
Loads a prepared dataset into shared memory so that one or more `osrm-routed`
170+
processes can serve it with zero-copy access. Enables live traffic updates
171+
without restarting the server.
172+
173+
```
174+
osrm-datastore [options] <base.osrm>
175+
```
176+
177+
| Flag | Short | Default | Description |
178+
|------|-------|---------|-------------|
179+
| `--dataset-name <name>` | | | Name for this dataset in shared memory. Allows multiple datasets to coexist. |
180+
| `--max-wait <s>` | `-1` (unlimited) | Seconds to wait for a running update to finish before forcibly acquiring the lock. |
181+
| `--only-metric` | | | Reload only the metric (weights/durations) without replacing the full dataset. Optimized for frequent traffic updates. |
182+
| `--disable-feature-dataset <name>` | | | Skip loading an optional dataset. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`. |
183+
| `--remove-locks` | `-r` | | Remove stale shared-memory locks and exit. |
184+
| `--spring-clean` | `-s` | | Remove all OSRM shared memory regions and exit. |
185+
| `--list` | | | List all datasets currently loaded in shared memory. |
186+
| `--list-blocks` | | | List all shared memory blocks currently in use. |

scripts/build_api_docs.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ if [ ! -f docs/http.md ] ; then
77
exit 1
88
fi
99

10+
# Optional: pass a subpath to serve the docs from, e.g. /docs/v1.2.3/
11+
# Usage: ./scripts/build_api_docs.sh /docs/v1.2.3/
12+
# Defaults to / for serving from the root of a static server.
13+
DOCS_BASE="${1:-/}"
14+
1015
# Clean up previous version
1116
rm -rf build/docs
1217

@@ -17,7 +22,7 @@ node scripts/extract_cpp_jsdoc.js src/nodejs/node_osrm.cpp > build/docs/jsdoc-ex
1722
npx documentation build build/docs/jsdoc-extract.js --markdown-toc=false -f md -o docs/nodejs/api.md
1823

1924
# Build static site with VitePress
20-
npx vitepress build docs
25+
DOCS_BASE="${DOCS_BASE}" npx vitepress build docs
2126

2227
# Copy the built site contents to build/docs (site root directly under build/docs)
2328
cp -a docs/.vitepress/dist/. build/docs/

0 commit comments

Comments
 (0)