0

while working with POSTGIS pgrouting, for calculateing the distance between two roads(lines) i got the shortest_path function.

But the logic is based on Start_point(Start_id) and end_point(end_id) but in my data the linestring contains so many internal points like ('linestring(1 1,2 2,3 3,4 4,5 5)' just for example..)

it is taking start point (1 1) endpoint(5 5)

if other line starting with (5 5) it is showing as route...like ('linestring(5 5,6 6)')

But line which crossing the point inside the linestring like(2 2,3 3,4 4) which is not telling as connected.. example

table roads: id name way 1 A linestring(1 1,2 2,3 3,4 4,5 5) 2 B linestring(5 5,6 6) 3 c linestring(2 1,2 2,2 3)

if i am applying shortest_path function from point(1 1) to (6 6) its showing the way but for (1 1) to (2 3) it is not showing anything...but there is a route for this (1 1,2 2,2 3)

can anyone please help me out for finding the solution..

Regards Deepak M

1 Answer 1

2

PgRouting shortestPath() runs the Dijkstra algorithm and finds the shorted route between two nodes.

To do that, pgRouting needs a routable network. What you described above doesn't sound like a routable network. It seems to be just an ordinary table of intersecting linestrings. This raw data has to be preprocessed into a structure of nodes and edges (connections between nodes). Every intersection has to be represented as a node. Without nodes there is no connectivity within the network.

2
  • hi underdark, means i need to convert my table in to routable by DE-NORMALIZING IT? i.e linestring(1 1, 2 2, 3 3) to be converted to linestring(1 1,2 2) and linestring(2 2,3 3)?
    – Deepak M
    Commented Aug 13, 2012 at 12:09
  • No, but you need to split edges at every intersection.
    – underdark
    Commented Aug 13, 2012 at 16:36

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.