[Cartoweb-users] A question related with using pgdijkstra module

Fay Du fay.du at versaterm.com
Thu Mar 2 08:56:15 EST 2006


Hi Franck:
 
Hi Franck:
Thank you very much. It does help me lot.
The node ID is pre-assigned to each town. I have dynamic points, which
are from GPS mounted in cars. They must get node ID on the fly. It is
why I want some quick method. I wonder except pgdijkstra module, is
there any other open source routing program exist? In my application, we
must use our own data as clients requirement. 
 
Fay
 
>Hi Fay,
 
>I think that this is the case for the demo_routing data: the towns
(town table) geometry are >independant from the roads (roads_europe
table) ones.
 
>On my side, I tried to replay the procedure given in the manual,
section 1.2.4.2. Some steps are not >detailled and I had to search the
nearest road start geometry for each town in order to create the >txt
field of the roads_europe_vertices table. To get most of the town
listed, I had to go up to >2000m, and then get the lowest distance for a
given town.
>To make it short, the SQL script looks like :
 
>...
>CREATE TABLE roads_source_town AS
>  select distinct t.txt, source_id, distance(PointN(r.the_geom,1) ,
t.the_geom) as d from >roads_europe r, town t, roads_europe_vertices 
>    where t.txt != 'UNK' AND distance(PointN(r.the_geom,1) ,
t.the_geom) < 2000 AND geom_id = >source_id ORDER BY t.txt , d ; 
>CREATE TABLE roads_source_town_uniq AS
>  select * from roads_source_town a where a.txt IN (select b.txt from
roads_source_town b where >a.txt = b.txt  limit 1) AND a.d IN (select
b.d from roads_source_town b where a.txt = b.txt  limit >1);
>UPDATE roads_europe_vertices set txt = (select distinct txt  from
roads_source_town_uniq  where >roads_europe_vertices.geom_id =
roads_source_town_uniq.source_id);
>...
 
>I am not sure this is the solution done to build the demo_routing.sql
database, and it is not >optimized, but it works. 
 
>Also it should be interesting to take in account the whole line
geometry of the roads instead of >just the initial point
(PointN(r.the_geom,1))...  but this may imply to cut some roads in
several >source_id/target_id...
 
>Franck
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060302/7009d2b4/attachment-0001.html


More information about the Cartoweb-users mailing list