I am trying to use pgRouting in order to find the shortest route between two points. I realized that pgr_dijkstra() function is not able to find the route when the two points are far from each other or when they are not very straight. However, when I select the two points in a neighbourhood, it can give me the shortest path.
This is the roads table (edges):
and this is the table of nodes that pgrouting created with the ending of "_vertices_pgr":
Does any one know what is the problem? I used this query:
select pgr_dijkstra('select id , source, target, st_length(geom) as cost FROM q_roads_noded', 10237, 10551)
q_roads is the table of roads (edges)
The network is like this: I tried to find the shortest path between points with id: 10237 and 10551. But the function returned nothing!!!
pgr_createTopology
will not break lines at intersections for you, you have to do this yourself ahead of time.pgr_dijkstra
assumes a directed graph (see function parameter), so only traversing edges insource-> target
direction is allowed; see if that's possible between those points.directed
which is equal tofalse
. Every edge has an implicit "direction", which goes from the source node to the target node. if you do not specify that you can also travel from the target node to the source node, it will assume that the graph is direction, and it will not allow a routing to occur if i requires going "backwards" along an edge.