I am in the process of creating a routing engine. I have encountered the following problem. Lets say the user gives a point A and point B and expects to get the A->B shortest path. I am using simple Dijkstra for now. Let's say that I can somehow find the However, a A' and B' must exist, very close to A and B respectively, so that the A'->B' path exists. So the routing engine should try and find that A'->B' path instead. Also, that A'->B' path might not even be optimal. There could have been a A''->B'' path, where A'' and B'' were only a couple of meters away from A and B. So the routing engine should find the A''->B'' optimal path instead. How do routing engines handle this situation ?
showing 5 of 7
show 2 more comments
|
"The problem is that for those nodes it is very likely that the A->B path doesn't exist at all. For example, if that node was part of a one-way road that went to the opposite direction that the user wanted to go to."
In such a case, the shortest route would still exist but just go in a different direction. A dead-end oneway should never exist on the ground and only rarely occur in the data as a tagging error, so I wouldn't call it "likely". Assuming the data is generally correctly-connected, there should almost always be some way to route.
@alester It doesn't have to be a dead-end. It could be a very long oneway road that would make you drive twice as long to go to your target location
Well if your car is on the very long oneway road going in the wrong direction then it is little use to you if the routing engine says "hey, I found a point A' very near the point you are at, and from there the way is much shorter".
@FrederikRamm I think you might be right here. I will see how good my routing engine works once I implement it successfully so that I can visualize the results with google maps.
@shiro900: why "google maps"? Did you hear of OSM already? ;-) Please use OSM!
@seerel4c26 Oh yes, I will definitely try OSM! I just had the google maps already set up.
Same question was also posted here: http://gis.stackexchange.com/questions/188677/shortest-path-problem-from-a-to-b-on-routing-engines