-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Move phantom node to the junction of the closest way #4192 [WIP] #4272
Conversation
Just stumbled over this PR again and I think it is not possible (at the phantom-node level) for how OSRM models streets currently. The RTree will always return the segment that is closed to your input coordinate, which would be your one-way street segment there. By just moving snapping to the end of that segment, you will still force OSRM to route into the oneway street. Finding the nearest intersection would require an own data structure that is indexed by points (intersection coordinates) and would return the Do you think we can close this PR? I'm currently cleaning up the PR queue. |
Yes you can close it. |
@frodrigo I don't think that's possible, just by the nature we index the data for location lookups. Implementing this at least involves the following steps:
(1) is straight forward but (2) and (3) require lager changes in the codebase. |
here's an idea for an ugly workaround to force the route to start and end from intersections: compute the route as normal, then remove the part before the first turn and after the last turn.. |
@emiltin is not so simple. The goal is to allow another computed route by having more possibilities at the junction than the phantom node position (think about oneway end). |
@TheMarex but it's not already the case if the input point is exactly on a junction ? We test this case and it seems working. |
@frodrigo The problem @TheMarex is describing with (2) is that currently, OSRM must start on an edge. If you supply a coordinate that is exactly an intersection, it will randomly snap to one of the connected roads. The distance from the snap point to the end of the road will be 0m, but the problem is that there will be turn costs calculated to move from the end of the snapped road onto the other directly connected roads - the route leaving the snapped road doesn't have the penalty. The values are usually quite small (6-8 seconds for the car profile), so they may not affect route calculation very much, but it's not technically perfect. This problem already exists in OSRM. Take the following scenario: The closest point on all three segments to the point is right at the intersection. The road that is snapped will depend on how the RTree is sorted. One thing we should probably do is modify the This doesn't solve the "only snap to intersections" problem, but it fixes the route calculation. If you could build an external index of intersections, and pre-snap your coordinates to those, then OSRM would do the right thing if you fed it intersection coordinates. I've opened #4465 describing this. The main problem implementing this is that a lot our test cases are going to need to be checked/modified, as they depend on RTree snapping order right now (which is deterministic, but not in a thought-out way). |
OK Thank you for your explanation. |
I am trying to develop the feature describe in this Issue #4192.
For the moment I tried two way :
For the moment both solution return a snaped point but the algorithm passes through the wrong arc (see the screenshot).
The code is extremely ugly, and i think the query should be made in static_rtree.hpp instead of geospatial_query.cpp.
Have you any idea to achieve this Issue ?
what i have :

what i want :
