Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hint with OSM segment id #3219

Open
TheMarex opened this issue Nov 1, 2016 · 1 comment
Open

Replace hint with OSM segment id #3219

TheMarex opened this issue Nov 1, 2016 · 1 comment

Comments

@TheMarex
Copy link
Member

TheMarex commented Nov 1, 2016

Currently we expose a base 64 encoded version of the PhantomNode class in our API as hint property and accept them as hints array on each query. This is useful when connecting multiple services and ensuring consistent snapping. For example a user can first use the match service to obtain hints from a snapped route and then feed them into the trip service to optimize the route. Using coordinates here causes problems since snapping is ambiguous. Consider for example the coordinate for an intersection, it is not clear which of the connection segments should be used.

This introduces a number of problems since the engine::Hint object is part of our C++ API and depends on the PhantomNode which is an internal implementation detail. Furthermore the size of each hint is quite large increasing the response size significantly. To retain the possibility to connecting services we need a stable approach, possibly across datasets.

The most stable thing we have is OSM ids. A pair of OSM node ids identifies a segment uniquely. To capture the fact that a coordinate can be snapped to the middle of the segment, we would also need some sort of progression along the segment.

Proposal

We encode hint values as:

{start}:{target}:{progression}

Example

26753078:2712265859:0.5 would correspond to this coordinate.

Problems to solve

  1. We need a way to go from OSM ids to internal node ids
  2. We need a way to go from internal node id pairs to edge-based-node ids and segment offset long the compressed geometry

If we could save 2. in RAM it would enable us to also cut a lot of data from the StaticRTree.

@emiltin
Copy link
Contributor

emiltin commented Nov 2, 2016

You can have multiple OSM ways between the same two nodes, e.g a way and a square sharing nodes as is the case here: http://www.openstreetmap.org/way/25822563. Would that be a problem?

Related to #610.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants