[Cartoweb-users] Help with pgdijkstra

Darren Houston dhouston at beyondcompliance.ca
Tue Feb 6 16:55:52 EST 2007


Hello everyone,

I am trying out the pgdijkstra library and am having difficulties getting it 
to work with my test dataset. Included is the sql to load the test dataset, 
and a SVG and PNG output of what the dataset looks like.

Running this sql works (finding the path from the start of the green line to 
the end of the yellow line)

SELECT gid,astext(the_geom) FROM shortest_path_as_geometry('line_test', 
(select v.id from line_test_vertices v join line_test g on v.geom_id =
g.source_id where g.ident=1), 
(select v.id from line_test_vertices v join line_test g on v.geom_id =
g.target_id where g.ident=3));


outputs


5|"MULTILINESTRING((665249.377865961 5662895.69047619,670545.577160494 
5659332.79276896,668812.275573192 5654999.53880071,670449.282627866 
5649607.04497354,674589.947530864 5645658.9691358))"

6|"MULTILINESTRING((674589.947530864 5645658.9691358,671701.111552028 
5635259.15961199,663419.781746032 5641325.71516755,652634.794091711 
5639688.70811287))"

7|"MULTILINESTRING((652634.794091711 5639688.70811287,650708.903439153 
5631022.20017637,656486.575396825 5624859.35008818,663227.192680776 
5629096.30952381,667560.44664903 5623222.34303351,671315.933421517 
5623126.04850088,677767.667107584 5629481.48765432))"


Running this sql does not work (finding the path from the start of the green 
line to the end of the red line)

SELECT gid,astext(the_geom) FROM shortest_path_as_geometry('line_test', 
(select v.id from line_test_vertices v join line_test g on v.geom_id =
g.source_id where g.ident=1), 
(select v.id from line_test_vertices v join line_test g on v.geom_id =
g.target_id where g.ident=4));


outputs


ERROR:  Error computing path: No path found
CONTEXT:  PL/pgSQL function "shortest_path_as_geometry_internal_id" line 9 at 
for over execute statement
PL/pgSQL function "shortest_path_as_geometry" line 24 at for over select rows


Looking at the tables and columns  pgdijkstra creates / fills, it seems that 
only the start and end vertices of a line are taken into consideration, hence 
pgdijkstra thinks that the red line is not connected to the network. Is this 
true? If so, any way to get pgdijkstra to work in this situation? Any help / 
ideas form seasoned pgdijkstra users is greatly appreciated.

Thank you,

Darren H.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: line_test.png
Type: image/png
Size: 4882 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/cartoweb-users/attachments/20070206/b5fbddd7/line_test.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: line_test.sql
Type: text/x-sql
Size: 1147 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/cartoweb-users/attachments/20070206/b5fbddd7/line_test.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: line_test.svg
Type: image/svg+xml
Size: 1373 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/cartoweb-users/attachments/20070206/b5fbddd7/line_test-0001.bin


More information about the Cartoweb-users mailing list