Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions docs/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ In addition to the [general options](#general-options) the following options are
|------------|---------------------------------------------|-------------------------------------------------------------------------------|
|alternatives|`true`, `false` (default), or Number |Search for alternative routes. Passing a number `alternatives=n` searches for up to `n` alternative routes.\* |
|steps |`true`, `false` (default) |Returned route steps for each route leg |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed`, `way_ids` |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false`, `by_legs` |Add overview geometry either full, simplified according to highest zoom level it could be displayed on, not at all, or split by leg.|
|continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. |
Expand Down Expand Up @@ -431,7 +431,7 @@ In addition to the [general options](#general-options) the following options are
|------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|steps |`true`, `false` (default) |Returned route steps for each route |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed`, `way_ids` |Returns additional metadata for each coordinate along the route geometry. |
|overview |`simplified` (default), `full`, `false`, `by_legs` |Add overview geometry either full, simplified according to highest zoom level it could be displayed on, not at all, or split by leg.|
|timestamps |`{timestamp};{timestamp}[;{timestamp} ...]` |Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. |
|radiuses |`{radius};{radius}[;{radius} ...]` |Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy.|
Expand Down Expand Up @@ -487,7 +487,7 @@ In addition to the [general options](#general-options) the following options are
|source |`any` (default), `first` |Returned route starts at `any` or `first` coordinate |
|destination |`any` (default), `last` |Returned route ends at `any` or `last` coordinate |
|steps |`true`, `false` (default) |Returned route instructions for each trip |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed`, `way_ids` |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false`, `by_legs` |Add overview geometry either full, simplified according to highest zoom level it could be displayed on, not at all, or split by leg.|

Expand Down Expand Up @@ -667,7 +667,7 @@ Represents a route between two waypoints.

| annotations | |
|--------------|-------------------------------------------------------------------------------|
| true | An `Annotation` object containing node ids, durations, distances, and weights. |
| true | An `Annotation` object containing the requested per-segment values, including node ids, way ids, durations, distances, and weights. |
| false | `undefined` |

#### Example
Expand All @@ -686,7 +686,8 @@ With `steps=false` and `annotations=true`:
"datasources": [1,0,0,0,1],
"metadata": { "datasource_names": ["traffic","lua profile","lua profile","lua profile","traffic"] },
"nodes": [49772551,49772552,49786799,49786800,49786801,49786802],
"speed": [0.3, 0.3, 0.3, 0.3, 0.3]
"speed": [0.3, 0.3, 0.3, 0.3, 0.3],
"way_ids": [111,111,222,222,333]
}
}
```
Expand All @@ -703,6 +704,7 @@ Annotation of the whole route leg with fine-grained information about each segme
- `nodes`: Array of OpenStreetMap node ids for each coordinate along the route (excluding the first/last user-supplied coordinates). Each id is a 64-bit unsigned integer (encoded as a JSON number for the `json` format, and as `ulong` for the `flatbuffers` format). Clients consuming flatbuffers should treat these values as 64-bit integers (JS bindings expose them as BigInt).
- `weight`: The weights between each pair of coordinates. Does not include any turn costs.
- `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place
- `way_ids`: The OSM way ID for each traversed segment along the route leg
- `metadata`: Metadata related to other annotations
- `datasource_names`: The names of the data sources used for the speed between each pair of coordinates. `lua profile` is the default profile, other values are the filenames supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`

Expand All @@ -715,7 +717,8 @@ Annotation of the whole route leg with fine-grained information about each segme
"datasources": [1,0,0,0,1],
"metadata": { "datasource_names": ["traffic","lua profile","lua profile","lua profile","traffic"] },
"nodes": [49772551,49772552,49786799,49786800,49786801,49786802],
"weight": [15,15,40,15,15]
"weight": [15,15,40,15,15],
"way_ids": [111,111,222,222,333]
}
```

Expand Down
7 changes: 4 additions & 3 deletions docs/nodejs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var osrm = new OSRM('network.osrm');
* `options.mmap_memory` **[Boolean][4]?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM.
* `options.path` **[String][3]?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared\_memory} to true.
* `options.disable_feature_dataset` **[Array][5]?** Disables a feature dataset from being loaded into memory if not needed. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`.
* `options.enable_feature_dataset` **[Array][5]?** Enables a feature dataset that is skipped by default. Options: `ROUTE_WAY_IDS`.
* `options.max_locations_trip` **[Number][6]?** Max. locations supported in trip query (default: unlimited).
* `options.max_locations_viaroute` **[Number][6]?** Max. locations supported in viaroute query (default: unlimited).
* `options.max_locations_distance_table` **[Number][6]?** Max. locations supported in distance table query (default: unlimited).
Expand Down Expand Up @@ -61,7 +62,7 @@ Returns the fastest route between two or more coordinates while visiting the way
* `options.alternatives` **[Number][6]** Search for up to this many alternative routes.
*Please note that even if alternative routes are requested, a result cannot be guaranteed.* (optional, default `0`)
* `options.steps` **[Boolean][4]** Return route steps for each route leg. (optional, default `false`)
* `options.annotations` **([Array][5] | [Boolean][4])** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
* `options.annotations` **([Array][5] | [Boolean][4])** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed`, `way_ids` or boolean for enabling/disabling all. (optional, default `false`)
* `options.geometries` **[String][3]** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
* `options.overview` **[String][3]** Add overview geometry either `full`, `simplified` according to highest zoom level it could be displayed on, or not at all (`false`). If you want the overview for each leg, you can use `by_legs`. (optional, default `simplified`)
* `options.continue_straight` **[Boolean][4]?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
Expand Down Expand Up @@ -227,7 +228,7 @@ if they can not be matched successfully.
* `options.hints` **[Array][5]?** Hints for the coordinate snapping. Array of base64 encoded strings.
* `options.generate_hints` **[Boolean][4]** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
* `options.steps` **[Boolean][4]** Return route steps for each route. (optional, default `false`)
* `options.annotations` **([Array][5] | [Boolean][4])** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
* `options.annotations` **([Array][5] | [Boolean][4])** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed`, `way_ids` or boolean for enabling/disabling all. (optional, default `false`)
* `options.geometries` **[String][3]** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
* `options.overview` **[String][3]** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
* `options.timestamps` **[Array][5]<[Number][6]>?** Timestamp of the input location (integers, UNIX-like timestamp).
Expand Down Expand Up @@ -298,7 +299,7 @@ Right now, the following combinations are possible:
* `options.hints` **[Array][5]?** Hints for the coordinate snapping. Array of base64 encoded strings.
* `options.generate_hints` **[Boolean][4]** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
* `options.steps` **[Boolean][4]** Return route steps for each route. (optional, default `false`)
* `options.annotations` **([Array][5] | [Boolean][4])** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
* `options.annotations` **([Array][5] | [Boolean][4])** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed`, `way_ids` or boolean for enabling/disabling all. (optional, default `false`)
* `options.geometries` **[String][3]** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
* `options.overview` **[String][3]** Add overview geometry either `full`, `simplified`, `false` or `by_legs`. (optional, default `simplified`)
* `options.roundtrip` **[Boolean][4]** Return route is a roundtrip. (optional, default `true`)
Expand Down
4 changes: 2 additions & 2 deletions docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ osrm-routed <base.osrm> [options]
| `--shared-memory` | `-s` | off | Load data from a shared memory region managed by `osrm-datastore`. |
| `--mmap` | `-m` | off | Memory-map the data files instead of loading them into RAM. |
| `--dataset-name <name>` | | | Shared memory dataset name to connect to (used with `--shared-memory`). |
| `--disable-feature-dataset <name>` | | | Skip loading an optional dataset to save memory. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`. |
| `--disable-feature-dataset <name>` | | | Skip loading an optional dataset to save memory. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`, `ROUTE_WAY_IDS`. |

### Query limits

Expand Down Expand Up @@ -179,7 +179,7 @@ osrm-datastore [options] <base.osrm>
| `--dataset-name <name>` | | | Name for this dataset in shared memory. Allows multiple datasets to coexist. |
| `--max-wait <s>` | `-1` (unlimited) | Seconds to wait for a running update to finish before forcibly acquiring the lock. |
| `--only-metric` | | | Reload only the metric (weights/durations) without replacing the full dataset. Optimized for frequent traffic updates. |
| `--disable-feature-dataset <name>` | | | Skip loading an optional dataset. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`. |
| `--disable-feature-dataset <name>` | | | Skip loading an optional dataset. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`, `ROUTE_WAY_IDS`. |
| `--remove-locks` | `-r` | | Remove stale shared-memory locks and exit. |
| `--spring-clean` | `-s` | | Remove all OSRM shared memory regions and exit. |
| `--list` | | | List all datasets currently loaded in shared memory. |
Expand Down
55 changes: 55 additions & 0 deletions features/options/data/disabled_dataset.feature
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,58 @@ Feature: disable-feature-dataset command line options
| trace | code |
| abc | Ok |

Scenario: way ids disabled by default error
Given the query options
| overview | false |
| annotations | way_ids |
| steps | false |

When I route I should get
| from | to | code |
| a | c | DisabledDataset |

When I plan a trip I should get
| waypoints | code |
| a,b,c | DisabledDataset |

When I match I should get
| trace | code |
| abc | DisabledDataset |

Scenario: way ids disabled by default success
Given the query options
| overview | false |
| annotations | duration |
| steps | false |

When I route I should get
| from | to | code |
| a | c | Ok |

When I plan a trip I should get
| waypoints | code |
| a,b,c | Ok |

When I match I should get
| trace | code |
| abc | Ok |

Scenario: enable-feature-dataset - way ids enabled success
Given the data load extra arguments "--enable-feature-dataset ROUTE_WAY_IDS"

And the query options
| overview | false |
| annotations | way_ids |
| steps | false |

When I route I should get
| from | to | code |
| a | c | Ok |

When I plan a trip I should get
| waypoints | code |
| a,b,c | Ok |

When I match I should get
| trace | code |
| abc | Ok |
2 changes: 2 additions & 0 deletions features/step_definitions/matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ When(/^I match I should get$/, async function (table) {
'datasources',
'nodes',
'weight',
'speed',
'way_ids',
];
if (k.match(/^a:/)) {
const a_type = k.slice(2);
Expand Down
1 change: 1 addition & 0 deletions features/support/shared_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export default class SharedSteps {
'nodes',
'weight',
'speed',
'way_ids',
];
const metadata_whitelist = ['datasource_names'];
if (k.match(/^a:/)) {
Expand Down
27 changes: 27 additions & 0 deletions features/testbot/way_ids.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@routing @testbot
Feature: Route annotations - way ids

Background:
Given the profile "testbot"
Given a grid size of 10 meters
Given the node map
"""
a--1-b--2-c--3-d
"""
And the ways
| nodes |
| ab |
| bc |
| cd |

Scenario: Route annotations expose traversed OSM way ids per segment
Given the data load extra arguments "--enable-feature-dataset ROUTE_WAY_IDS"

Given the query options
| steps | false |
| annotations | way_ids |

When I route I should get
| from | to | a:way_ids |
| 1 | 3 | 5:6:7 |
| 3 | 1 | 7:6:5 |
3 changes: 2 additions & 1 deletion include/engine/api/flatbuffers/route.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ table Annotation {
weight: [uint];
speed: [float];
metadata: Metadata;
way_ids: [ulong];
}

enum ManeuverType: byte {
Expand Down Expand Up @@ -109,4 +110,4 @@ table RouteObject {
polyline: string;
coordinates: [Position];
legs: [Leg];
}
}
Loading