1

I am trying to use pgrouting's shortestpath function. It returns a set of edges for the shortest path. However, the start node of the next edge is not the end node of the previous edge. I mean they are not connected. So while displaying I am joining the end node of the first edge to the start node of the next edge.

However, I am seeing that the coordinates are repeating. I am not sure why, For eg plotting just the coordinates of the start and end node of each edge, I have something like this:

start end
A     B 
C     D
A     E

As you can see the coordinates are repeating like A,A in the previous case. As a result there are lots of lines crossing over.

Any suggestions or clarifications?

1 Answer 1

2

Better you post your query as well to see what you're trying to do.

The reason might be that the query returns the list of edges in the way they are stored in the database. And they are stored in the database as they have been digitized/imported. So what is the start of an edge and what is the end depends on how they were created.

If not only the geometry but also the start end end order of the route is important for you, you need to check this as an additional step.

Possibility 2 (reading your post once more):

If your result is even more weird, then probably your network topology is wrong. How did you get source and target ID columns?

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.