Calculate route distance regardless of road direction (highway)

Hi all,

For what I’m trying to build I need to calculated the distance between current location and fixed point. Problem is the point is on a highway where the two directions are considered as separate one-way roads so depending on the direction I’m coming from I either get different result.
Direction A: straight to the point;
Direction B: pass the point, U-turn on next intersection, get to the point.

I fully understand that’s the idea of road navigation ( :slight_smile: ) but is there a way around it? Like getting the distance to the point with a certain tolerance.

That’s the example when coming from “Direction B”.

Any help is appreciated :slight_smile:

On the public API this is not possible. You might send the coordinates twice in order of direction A and direction B and choose the shorter result.

If it is an option to run your own instance of ORS, it should be relatively easy to adapt a profile to ignore any one-way and turn restrictions. However, depending on how precise your coordinates match to the routing graph, on a highway they could still snap to the different lanes.

Best regrads

Thanks, Sascha!

Is there a way to get the (shorter) result to 2+ waypoints with a single call, in order not to overload the public API server?



I’m not quite sure I follow what you want to do, but you can of course plan a route from your start location to your endpoint and back to your startpoint, passing three coordinates.

I don’t know whether that’s what you’re looking for though.

Best regards