[Cartoweb-users] Pgdijkstra Directed Map

Sylvain Pasche sylvain.pasche at camptocamp.com
Thu Aug 17 09:48:44 EDT 2006


Hi,

Le jeudi 17 août 2006 à 16:34 +0800, Aileen Baylon a écrit :
> Hi all,
> 
> I've been tinkering with Cartoweb, PostGIS & Pgdijkstra for quite some time 
> now.
> 
> My questions are
> 
> 1. How do you use the PostgreSQL shortest_path function so that it would 
> help you create a directed route?
> ex.
> SELECT * FROM shortest_path('SELECT id, source, target, cost FROM 
> major_roads_edges', 815, 750, true, false);

What do you mean about directed route? If you mean returning a postgis
PATH, you can refer to the following example at
http://www.cartoweb.org/downloads/pgdijkstra/README.txt about using the
shortest_path_as_geometry() function.


> 2. How do you update the cost of the table using update_cost_from_distance 
> if you have an existing distance in that table?

Well, don't touch it if it's already there ;-)

update_cost_from_distance is used when you do not have the distance
available. If you already have it in your table it is of no use for you.

> 3. What exactly is create_graph_tables for? Is it not the function that 
> would fill the edges and vertices tables of the resulting graph? The 
> assign_vertex_id function is to fill the columns source_id and target_id 
> right? But if I don't execute the assign_vertex_id function since I already 
> have a source ID and target ID, why is it that I get the error?

create_graph_tables is used to create auxiliary tables which are used
for filling id's from an existing dataset. You should call it before
using pgdijkstra shortest_path function to prepare the data. 
See the example in the README for an illustration.

Regards,

Sylvain



More information about the Cartoweb-users mailing list