I am having some issues when using pgrouting's shortest path. I am following this tutorial available at http://workshop.pgrouting.org/chapters/shortest_path.html#dijkstra. This query returns a list of edges. Then I get the start and end points of each edge. Then I just join these points to show the shortest path. Just to let you know that I don't necessarily get the ending point of the first edge in the list to be the starting point of the second edge in the list returned. So I join, the ending and starting points of the two edges as well. However, sometimes the points are repeated and I have lines crossing over each other and the path looks a mess. What could be the reason behind this?

  • you need to assign_vertex_id('<table>', float tolerance, '<geometry column', '<gid>') workshop.pgrouting.org/chapters/topology.html
    – Mapperz
    May 30, 2012 at 15:32
  • I already have it. I actually used osm2p tool to create the table consisting of the edges with their corresponding vertices May 30, 2012 at 17:55

1 Answer 1


The result of shortest path is not ordered. Therefore you cannot rely on it. To visualize the results, you could use the edge geometries instead.

  • Do you know any way to order them in postgressql?
    – Del Pedro
    Feb 4, 2016 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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