[Cartoweb-users] PGDijkstra usage
sylvain.pasche at camptocamp.com
Wed Aug 3 08:21:53 EDT 2005
Le mercredi 03 août 2005 à 12:49 +0200, Till Adams a écrit :
> thank you very much - I got my data into it and it works! But, I don't
> really know why.... my main problems were the following and I'm not
> sure, if I really understood this points:
> I used the Sql "test_postgis-sql" and edited it, so it fits on my data:
> I replaced the name "graph2" with my table name. OK.
> Then I run the sql-statements step-by-step and from that two questions
> Where does the values '1' and '14' come from in this statement??
These values are node identifiers which are just examples. You can look
in the README file, which gives some documentation about the
CREATE OR REPLACE FUNCTION shortest_path(sql text, source_id integer,
The 1 is the source_id and the 14 is the target_id:
- source: an int4 identifier of the source vertex
- target: an int4 identifier of the target vertex
> SELECT * FROM shortest_path('SELECT id, source, target, cost FROM
> graph2_edges', 1, 14, false, false)
> And the same in the next statement:
> SELECT gid, asText(the_geom) FROM shortest_path_as_geometry('graph2',1,10)
> Where do the values '1' and '10' come from // how to I adapt them on my
These are also examples, of node identifiers. With your data, it means
the identifier of the starting point and of the target point.
> I just used two random values, because using yours let the sql stop with
> an error - I only have 5 objectsi n my test-data till now.
There is an error for instance if there is no path between the source
and the target. There should be a message like "no path found" for
> Thanks again - and this is hopefully the last time, I asked you directly.
Otherwise, I would suggest you write to the mailing list, hopefully
other people can answer and read the mail.
> I can write a "data-insert HowTo" if you like, it's often better, when
> persons, who didn't do the programming write the documentation ;-)
Yes, the documentation is quite lacking, I admit. That would be great if
you want to write some documentation. Maybe we should transform the
README into a more complete documentation, with several chapters, like
"data importing/inserting", "using the shortest_path function",
"mapserver integration". We could then integrate this into the cartoweb
documentation (it is in docbook format).
More information about the Cartoweb-users