[Cartoweb-users] dijkstra - miss up node ID - again, with solutions

Fay Du fay.du at versaterm.com
Thu Jan 12 08:39:41 EST 2006


There are 2 solutions which can solve your problem.
 
I still use my table name, roads, roads_edges, and roads_ vertices.
1. Go to roads_ vertices table, 
    select id from roads_vertices where  geom_id=4769 or geom_id= 4770;
    It will return your two rows. 
    Use returned two ids to replace 4769 and 4770 in your command.
 
2. Instead of using shortest_path function, use shortest_path
_as_geometry. This function takes node id from Table roads. So 4769 and
4770 will works. Of cause, you need to make change to satisfy
shortest_path _as_geometry signature. And the return is different. As
function name indicates, it will return line geometry with edge ID.
 
Fay
-----Original Message-----
From: cartoweb-users-bounces at lists.maptools.org
[mailto:cartoweb-users-bounces at lists.maptools.org] On Behalf Of Fay Du
Sent: Wednesday, January 11, 2006 4:36 PM
To: 'Eggenschwiler Raphael'
Cc: cartoweb-users at lists.maptools.org
Subject: RE: [Cartoweb-users] dijkstra - miss up node ID
 
I believe there is ID miss up.
 
If you run sample data step by step, there are 3 tables roads,
roads_edges, and roads_ vertices.
 
In table roads, souce_id and target_id are different with roads_edges.
But the two ids (same node, but it has two different ID in table roads
and roads_edges) are connected by table roads_ vertices. In roads_
vertices, id is the source/target used in roads-edges, and gid is the id
of same node used in tables roads.
 
Shortest_path asks for id from roads_edges. What you passed are node ID
from Table roads. It is why program cannot find the path.
 
Fay
 
-----Original Message-----
From: cartoweb-users-bounces at lists.maptools.org
[mailto:cartoweb-users-bounces at lists.maptools.org] On Behalf Of
Eggenschwiler Raphael
Sent: Tuesday, January 10, 2006 9:10 AM
To: cartoweb-users at lists.maptools.org
Subject: [Cartoweb-users] dijkstra
 
Hi everyone !

I try to use this pgdijkstra on my data with :

SELECT arc_num_nod_src as "source",arc_num as "id",arc_num_nod_des as
"target",arc_cost as "cost" FROM TAB_ARC; 

source   id    target    cost
0         6259    4769    0
4769    6260    4770    0
4770    6261    4771    0
4771    6262    4772    0
4772    6263    4773    0
0         6264    4775    0 
4775    6265    4776    0
4776    6266    4777    0
4777    6267    4778    0
4778    6268    4779    0
4779    6269    4780    0
4780    6270    4781    0
0         6271    4783    0
4783    6272    4784    0 
4784    6273    4785    0
4785    6274    4786    0
4786    6275    4787    0
4787    6276    4788    0
4788    6277    4789    0
4789    6278    4790    0
0         6279    4792    0
4792    6280    4793    0 

But when I try this one :

select * from shortest_path('SELECT arc_num_nod_src as "source",arc_num
as "id",arc_num_nod_des as "target",arc_cost as "cost" FROM
TAB_ARC',4769,4770,false,false); 

I become this message :

ERROR:  Error computing path: Source vertex not found

Can someone help me ??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060112/999db87f/attachment-0001.html


More information about the Cartoweb-users mailing list