[Cartoweb-users] PGDijkstra usage
sylvain.pasche at camptocamp.com
Tue Aug 2 12:30:39 EDT 2005
Le mardi 02 août 2005 à 15:18 +0200, Till Adams a écrit :
> Dear Sylvain,
> sorry for asking too many questions ... but:
> I'm trying to use the extension: I loaded the data from
> /test/data_postgis.sql which made me a table called "graph2"
> in my postgis enabled database.
> So, everything from your demo works fine. What is missing to me is an
> idea how to structure my own data, may there is an example?
It is intentional that there is no constraints on the data structure you
can use with the algorithm, because you may have different needs
according to your application domain.
However, if you have a shapefile with an source and target node
identifier for each of your nodes, you can use the create_graph_tables
function, which will read your shapefile table and create some internal
tables (there is also a function which guesses starting and ending nodes
from their relative distance, see dijkstra_postgis.sql).
The best example for this is to follow the test_postgis.sql file.
> I dumped the table graph2 as shape, loaded it into sth. proprietary, but
> I'm not sure how to set the cost-factor for the data? There must be any
> tools for giving e.g. highway lower costs than a country road?
you can use the function update_cost_from_distance which will set costs
according to the geographical distance.
Otherwise, you can use a SQL update statement to give higher cost to
highways (like "update my_table set cost = cost * 1.05 where highway =
More information about the Cartoweb-users