A* Pathfinding Project

Shortest Route problem


The nearest Node is far away. The path is not built correctly. How can I fix this?



The nearest node to the end point is that one that it has picked. The system will always pick the closest node, not the closest point along a node connection. This is not done because in pretty much all common scenarios it is identical and it would be very slow as it can not be optimized well in the same way as point queries can. To solve this in your case I would recommend adding multiple points in between the 1st and 2nd nodes, or more generally along all long streets in your graph.


Ok, thanks! I manually increased the number of vertices. There is another problem.

Are there any settings that allow using a few iterations to find the minimum distance? By gradually increasing the radius or enumerating all the points in the radius.



That start point is unambiguously closer to the 1st iteration point. Even when checking distances to the line segments, so I think that will be tricky to fix.



I am just uploading version 4.2.8 (https://www.arongranberg.com/astar/download) which adds a new option for the point graph that determines how the closest nodes should be found. Try it out and set the nearest node mode to ‘Connection’. I think that might work better for you.