Hello everyone, I received good help from Marc on the PostGIS Users' mailing list. Basically he told me that pgdijkstra is working as it should. From his explanation, a shared vertex doesn't necessarily mean two lines have a common node (think a bridge crossing a street). Only start and end nodes are taken into consideration.
Long story short; my current dataset will not work with pgdijkstra. I have written some routines that automatically clean up my dataset and apply the pgdijkstra functions. It's hit and miss, but I am getting some expected results. Darren H. On Tuesday 06 February 2007 14:55, Darren Houston wrote: > 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. _______________________________________________ Cartoweb-users mailing list Cartoweb-users@lists.maptools.org http://lists.maptools.org/mailman/listinfo/cartoweb-users