Restricting Turns and Snapping Points in GraphHopper

Hello everyone,

I really need your help. I’m trying to plan a route for trains using the car profile in GraphHopper. Can you please advise if there is a way to restrict turns more than 90 degrees in the route?

Also, when using imprecise data, I noticed that one of the points in the route may deviate. Is there a way to make GraphHopper snap this point to the nearest road to avoid sharp turns, like the 2nd point shown in the attached image?

Thank you in advance for your assistance!

There is an experimental branch where you can configure the turn costs based on the turn angle: Using turn costs, not just turn restrictions · Issue #1590 · graphhopper/graphhopper · GitHub

Is there a way to make GraphHopper snap this point to the nearest road to avoid sharp turns, like the 2nd point shown in the attached image?

No easy solutions I know but you could let the routing algorithm start at those two points and pick the shortest route at the end.

trains using the car profile in GraphHopper

This does not sound optimal … have a look into GitHub - geofabrik/OpenRailRouting: routing on railway tracks using OpenStreetMap data and the GraphHopper routing engine

1 Like

Peter, thank you for the quick response!

@karussell
Hello! Your response was very helpful to me. Thank you! I managed to set up turn costs, and now the route is being calculated without sharp turns. :tada:

There’s one more thing I want to clarify. Is it possible, based on the received point, to find the nearest points on other paths within a specified radius? Just like in the screenshot. If point 1 was received, I want to calculate the route to all neighboring points to find the shortest path. As you advised me in your response, I think this would be a good solution.

image

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