Suboptimal route with via points and no u-turn

I’d like to reproduce OSM route relation 35546 using it’s stops as via nodes. However, the search optimizes locally to reach the via node fast, just to make a detour afterwards when getting to the end node (as u-turns are not allowed):

I wonder if there is an option to avoid this, like e.g. a backward search?

If not, it might perhaps be an option to deduce a heading, taking the street side of the bus_stop into account. Could this be done easily, e.g. by forcing that an unsnapped via point should be approached so it is e.g. right-hand-side?

Best regards,

This is an interesting question and a perfect showcase how our ‘greedy’ approach of calculating via routes can fail: We first calculate the route from the first stop to the via node and then take this result for granted. Only to find out that it would have been better to choose a (for the first leg) sub-optimal path, because under the condition that we do not want to take a u-turn at the via node we have to take a long route from the via node to the target. This results in an overall sub-optimal path.

Did you use turncosts/edge-based here ? If you use turn costs you can enforce curbside=right for the via node to make sure the via node is approached ‘north-to-south’ instead of ‘south-to-north’, which should yield a better result. This is certainly not ideal, because ultimately this decision should be made by the routing engine.

No, currently there is no better way than using curbside or a heading at the via node. Maybe the easiest way though is adding another via node ?!

Thanks for the immediate reply!
And thanks for pointing me to curbside=right, I’ll try this. Yes, I’m using edge-based/turncosts. Adding another via node is a valid option, though I want to avoid it if possible (but I’m currently thinking of an OSM proposal to introduce such viaNodes in route relations.)

Just make sure to set curbside=any for the other points (you either need to set curbside for all or none of the points. Using any does not constrain the route.

In issue 1765 @michaz proposes to switch to map-matching instead of via-routing. Thanks for the suggestion, which didn‘t came to my mind yet, as I thought the via-points would be to sparse. I‘ll try this…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Powered by Discourse