I have currently all the postgis and pgrouting functions loaded, a table with the “the_geom”, “gid”, “source”, “target”, “length” fields, as described in the link above and a table that will contain the results of dijkstra (steps 5, 6,7,8).
I get stuck when I call the “dijkstra_sp” function (step 8)… the error msg is:
ERROR: source contains a null value
CONTEXT: PL/pgSQL function “dijkstra_sp” line 12 at cycle FOR in an instruction EXECUTE
Great! After playing a little… I made it work J Many thanks…
Next I need to figure out:
How to compute the distance associated to the shortest path (is it ok if I define in the table dijsktra_result a new column “length” and I use the function “UPDATE edges SET length = length(the_geom);”?)
Visualize the indexes of the origin and destinations in the map (so as I can compute shortest paths from known origins and destinations)
Arrange everything in a two “for cycles” so to come out with an origin destination matrix…
Great! After playing a little… I made it work J Many thanks…
Next I need to figure out:
How to compute the distance associated to the shortest path (is it ok if I define in the table dijsktra_result a new column “length” and I use the function “UPDATE edges SET length = length(the_geom);”?)
Visualize the indexes of the origin and destinations in the map (so as I can compute shortest paths from known origins and destinations)
Arrange everything in a two “for cycles” so to come out with an origin destination matrix…
Maybe you want to look at the workshop once: http://workshop.pgrouting.org
It will answer the most common questions.
If you need a distance matrix, you could try APSP (All-pair-shortest-path) algorithm, that Jay developed a few weeks ago. It’s currently in the pgRouting fork of his Github account. But you probably better don’t try this on Windows, because compiling pgRouting on Windows isn’t trivial task.