Currently, the pgrouting 1. 5 version has a shortest path function which actually traces a path from nearest vertex of source to nearest vertex of destination but. As, Dijkstra's algorithm works on the principle of vertex to vertex routing. But, if the location (point geometry) lies at somewhere in the mid of the road geometry and I want the path to be traced until that location exactly, is there a special function or way to do the same in pgrouting? In short, currently node to node routing happens. Whereas, I am looking for point to point routing.

Please refer: http://www.mapgears.com/downloads/foss4g2013/foss4g2013-pgrouting-for-dummies.pdf As per this document as well as issues raised in the mailing list, this script helps in achieving that. But, I figured out that there are multiple issues in the routing_core_smart.sql file. Some tweaking needs to be done to make it work. And that is what is unknown.

  • Conceptually, the only valid points are at the vertices (nodes in the graph). You can't really route to anything else. You could just find the closest vertex to your point, and manually "jump" to that. There could be nasty corner cases though (such as if the road is one way). – BradHards Oct 25 '13 at 6:53

Point to point routing can be achieved by adding virtual nodes/vertices in the network table. The actual source/destination locations if don't lie at the cross section of two or more road geometries, consider those locations as virtual vertices and calculate the length of the roads from the virtual points as references.

| improve this answer | |

Might be a stupid idea but I would first use ST_Split to cut the line on my point then calculate the shortest path using that new line.

| improve this answer | |
  • St_Split is available only in pgrouting 2.0 version. I want to achieve the above by using pgrouting 1.5 function. – Sugandha Oct 25 '13 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.