Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Unreleased
- Changes from 5.24.0
- Features:
- ADDED: a new `ways` subsection in the `annotations` section containing way IDs along the found path, with sign meaning direction [#5325](https://github.com/Project-OSRM/osrm-backend/issues/5325)
- API:
- FIXED: item type for `nodes` section of the `annotations` flatbuffers output format

# 5.24.0
- Changes from 5.23.0
Expand Down
8 changes: 5 additions & 3 deletions docs/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,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`, `ways`, `distance`, `duration`, `datasources`, `weight`, `speed` |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` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|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 @@ -430,7 +430,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`, `ways`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|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 @@ -486,7 +486,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`, `ways`, `distance`, `duration`, `datasources`, `weight`, `speed` |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` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|

Expand Down Expand Up @@ -700,6 +700,7 @@ Annotation of the whole route leg with fine-grained information about each segme
- `duration`: The duration between each pair of coordinates, in seconds. Does not include the duration of any turns.
- `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`. String-like names are in the `metadata.datasource_names` array.
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
- `ways`: The OSM way ID for each pair of neighbor nodes in the list of nodes, with a sign. The sign means direction. A positive sign means moving in the direction of the way, while negative means moving in the opposite direction.
- `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
- `metadata`: Metadata related to other annotations
Expand All @@ -714,6 +715,7 @@ 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],
"ways": [130764281,130764281,-6056749,-6056749,-6056749],
"weight": [15,15,40,15,15]
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/nodejs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Returns the fastest route between two or more coordinates while visiting the way
- `options.alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** 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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `ways`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 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.continue_straight` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** 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 @@ -215,7 +215,7 @@ if they can not be matched successfully.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `ways`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp).
Expand Down Expand Up @@ -282,7 +282,7 @@ Right now, the following combinations are possible:
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `ways`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
Expand Down
3 changes: 3 additions & 0 deletions include/engine/api/flatbuffers/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

../../../../build/flatbuffers-build/flatc --cpp --no-includes --gen-all --gen-object-api fbresult.fbs
38 changes: 28 additions & 10 deletions include/engine/api/flatbuffers/fbresult_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ struct AnnotationT : public flatbuffers::NativeTable {
std::vector<uint32_t> distance;
std::vector<uint32_t> duration;
std::vector<uint32_t> datasources;
std::vector<uint32_t> nodes;
std::vector<uint64_t> nodes;
std::vector<int64_t> ways;
std::vector<uint32_t> weight;
std::vector<float> speed;
std::unique_ptr<osrm::engine::api::fbresult::MetadataT> metadata;
Expand All @@ -476,9 +477,10 @@ struct Annotation FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VT_DURATION = 6,
VT_DATASOURCES = 8,
VT_NODES = 10,
VT_WEIGHT = 12,
VT_SPEED = 14,
VT_METADATA = 16
VT_WAYS = 12,
VT_WEIGHT = 14,
VT_SPEED = 16,
VT_METADATA = 18
};
const flatbuffers::Vector<uint32_t> *distance() const {
return GetPointer<const flatbuffers::Vector<uint32_t> *>(VT_DISTANCE);
Expand All @@ -489,8 +491,11 @@ struct Annotation FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<uint32_t> *datasources() const {
return GetPointer<const flatbuffers::Vector<uint32_t> *>(VT_DATASOURCES);
}
const flatbuffers::Vector<uint32_t> *nodes() const {
return GetPointer<const flatbuffers::Vector<uint32_t> *>(VT_NODES);
const flatbuffers::Vector<uint64_t> *nodes() const {
return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_NODES);
}
const flatbuffers::Vector<int64_t> *ways() const {
return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_WAYS);
}
const flatbuffers::Vector<uint32_t> *weight() const {
return GetPointer<const flatbuffers::Vector<uint32_t> *>(VT_WEIGHT);
Expand All @@ -511,6 +516,8 @@ struct Annotation FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
verifier.VerifyVector(datasources()) &&
VerifyOffset(verifier, VT_NODES) &&
verifier.VerifyVector(nodes()) &&
VerifyOffset(verifier, VT_WAYS) &&
verifier.VerifyVector(ways()) &&
VerifyOffset(verifier, VT_WEIGHT) &&
verifier.VerifyVector(weight()) &&
VerifyOffset(verifier, VT_SPEED) &&
Expand All @@ -536,9 +543,12 @@ struct AnnotationBuilder {
void add_datasources(flatbuffers::Offset<flatbuffers::Vector<uint32_t>> datasources) {
fbb_.AddOffset(Annotation::VT_DATASOURCES, datasources);
}
void add_nodes(flatbuffers::Offset<flatbuffers::Vector<uint32_t>> nodes) {
void add_nodes(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> nodes) {
fbb_.AddOffset(Annotation::VT_NODES, nodes);
}
void add_ways(flatbuffers::Offset<flatbuffers::Vector<int64_t>> ways) {
fbb_.AddOffset(Annotation::VT_WAYS, ways);
}
void add_weight(flatbuffers::Offset<flatbuffers::Vector<uint32_t>> weight) {
fbb_.AddOffset(Annotation::VT_WEIGHT, weight);
}
Expand All @@ -565,14 +575,16 @@ inline flatbuffers::Offset<Annotation> CreateAnnotation(
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> distance = 0,
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> duration = 0,
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> datasources = 0,
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> nodes = 0,
flatbuffers::Offset<flatbuffers::Vector<uint64_t>> nodes = 0,
flatbuffers::Offset<flatbuffers::Vector<int64_t>> ways = 0,
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> weight = 0,
flatbuffers::Offset<flatbuffers::Vector<float>> speed = 0,
flatbuffers::Offset<osrm::engine::api::fbresult::Metadata> metadata = 0) {
AnnotationBuilder builder_(_fbb);
builder_.add_metadata(metadata);
builder_.add_speed(speed);
builder_.add_weight(weight);
builder_.add_ways(ways);
builder_.add_nodes(nodes);
builder_.add_datasources(datasources);
builder_.add_duration(duration);
Expand All @@ -585,14 +597,16 @@ inline flatbuffers::Offset<Annotation> CreateAnnotationDirect(
const std::vector<uint32_t> *distance = nullptr,
const std::vector<uint32_t> *duration = nullptr,
const std::vector<uint32_t> *datasources = nullptr,
const std::vector<uint32_t> *nodes = nullptr,
const std::vector<uint64_t> *nodes = nullptr,
const std::vector<int64_t> *ways = nullptr,
const std::vector<uint32_t> *weight = nullptr,
const std::vector<float> *speed = nullptr,
flatbuffers::Offset<osrm::engine::api::fbresult::Metadata> metadata = 0) {
auto distance__ = distance ? _fbb.CreateVector<uint32_t>(*distance) : 0;
auto duration__ = duration ? _fbb.CreateVector<uint32_t>(*duration) : 0;
auto datasources__ = datasources ? _fbb.CreateVector<uint32_t>(*datasources) : 0;
auto nodes__ = nodes ? _fbb.CreateVector<uint32_t>(*nodes) : 0;
auto nodes__ = nodes ? _fbb.CreateVector<uint64_t>(*nodes) : 0;
auto ways__ = ways ? _fbb.CreateVector<int64_t>(*ways) : 0;
auto weight__ = weight ? _fbb.CreateVector<uint32_t>(*weight) : 0;
auto speed__ = speed ? _fbb.CreateVector<float>(*speed) : 0;
return osrm::engine::api::fbresult::CreateAnnotation(
Expand All @@ -601,6 +615,7 @@ inline flatbuffers::Offset<Annotation> CreateAnnotationDirect(
duration__,
datasources__,
nodes__,
ways__,
weight__,
speed__,
metadata);
Expand Down Expand Up @@ -1974,6 +1989,7 @@ inline void Annotation::UnPackTo(AnnotationT *_o, const flatbuffers::resolver_fu
{ auto _e = duration(); if (_e) { _o->duration.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->duration[_i] = _e->Get(_i); } } };
{ auto _e = datasources(); if (_e) { _o->datasources.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->datasources[_i] = _e->Get(_i); } } };
{ auto _e = nodes(); if (_e) { _o->nodes.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->nodes[_i] = _e->Get(_i); } } };
{ auto _e = ways(); if (_e) { _o->ways.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->ways[_i] = _e->Get(_i); } } };
{ auto _e = weight(); if (_e) { _o->weight.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->weight[_i] = _e->Get(_i); } } };
{ auto _e = speed(); if (_e) { _o->speed.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->speed[_i] = _e->Get(_i); } } };
{ auto _e = metadata(); if (_e) _o->metadata = std::unique_ptr<osrm::engine::api::fbresult::MetadataT>(_e->UnPack(_resolver)); };
Expand All @@ -1991,6 +2007,7 @@ inline flatbuffers::Offset<Annotation> CreateAnnotation(flatbuffers::FlatBufferB
auto _duration = _o->duration.size() ? _fbb.CreateVector(_o->duration) : 0;
auto _datasources = _o->datasources.size() ? _fbb.CreateVector(_o->datasources) : 0;
auto _nodes = _o->nodes.size() ? _fbb.CreateVector(_o->nodes) : 0;
auto _ways = _o->ways.size() ? _fbb.CreateVector(_o->ways) : 0;
auto _weight = _o->weight.size() ? _fbb.CreateVector(_o->weight) : 0;
auto _speed = _o->speed.size() ? _fbb.CreateVector(_o->speed) : 0;
auto _metadata = _o->metadata ? CreateMetadata(_fbb, _o->metadata.get(), _rehasher) : 0;
Expand All @@ -2000,6 +2017,7 @@ inline flatbuffers::Offset<Annotation> CreateAnnotation(flatbuffers::FlatBufferB
_duration,
_datasources,
_nodes,
_ways,
_weight,
_speed,
_metadata);
Expand Down
Loading