Skip to content

Commit

Permalink
Project-OSRM#5325 Documentation changes and some fix for flatbuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
nnseva committed Feb 15, 2021
1 parent c2015a8 commit d69d0c2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
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 neighbour nodes in the list of nodes
- `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
28 changes: 14 additions & 14 deletions include/engine/api/flatbuffers/fbresult_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +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<uint32_t> ways;
std::vector<uint64_t> nodes;
std::vector<uint64_t> ways;
std::vector<uint32_t> weight;
std::vector<float> speed;
std::unique_ptr<osrm::engine::api::fbresult::MetadataT> metadata;
Expand Down Expand Up @@ -491,11 +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<uint32_t> *ways() const {
return GetPointer<const flatbuffers::Vector<uint32_t> *>(VT_WAYS);
const flatbuffers::Vector<uint64_t> *ways() const {
return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_WAYS);
}
const flatbuffers::Vector<uint32_t> *weight() const {
return GetPointer<const flatbuffers::Vector<uint32_t> *>(VT_WEIGHT);
Expand Down Expand Up @@ -543,10 +543,10 @@ 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<uint32_t>> ways) {
void add_ways(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> ways) {
fbb_.AddOffset(Annotation::VT_WAYS, ways);
}
void add_weight(flatbuffers::Offset<flatbuffers::Vector<uint32_t>> weight) {
Expand Down Expand Up @@ -575,8 +575,8 @@ 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<uint32_t>> ways = 0,
flatbuffers::Offset<flatbuffers::Vector<uint64_t>> nodes = 0,
flatbuffers::Offset<flatbuffers::Vector<uint64_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) {
Expand All @@ -597,16 +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<uint32_t> *ways = nullptr,
const std::vector<uint64_t> *nodes = nullptr,
const std::vector<uint64_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 ways__ = ways ? _fbb.CreateVector<uint32_t>(*ways) : 0;
auto nodes__ = nodes ? _fbb.CreateVector<uint64_t>(*nodes) : 0;
auto ways__ = ways ? _fbb.CreateVector<uint64_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 Down
4 changes: 2 additions & 2 deletions include/engine/api/flatbuffers/route.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ table Annotation {
distance: [uint];
duration: [uint];
datasources: [uint];
nodes: [uint];
ways: [uint];
nodes: [ulong];
ways: [ulong];
weight: [uint];
speed: [float];
metadata: Metadata;
Expand Down
4 changes: 2 additions & 2 deletions include/engine/api/route_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class RouteAPI : public BaseAPI
return anno.datasource;
});
}
std::vector<uint32_t> nodes;
std::vector<uint64_t> nodes;
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
{
nodes.reserve(leg_geometry.osm_node_ids.size());
Expand All @@ -503,7 +503,7 @@ class RouteAPI : public BaseAPI
nodes.emplace_back(static_cast<uint64_t>(node_id));
}
}
std::vector<uint32_t> ways;
std::vector<uint64_t> ways;
if (requested_annotations & RouteParameters::AnnotationsType::Ways)
{
ways.reserve(leg_geometry.osm_way_ids.size());
Expand Down

0 comments on commit d69d0c2

Please sign in to comment.