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

zze-SIGALE PORTANERI F ext RD-BIZZ-SOP fportaneri.ext at rd.francetelecom.com
Wed Mar 1 12:21:15 EST 2006


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

 
________________________________

De : cartoweb-users-bounces at lists.maptools.org [mailto:cartoweb-users-bounces at lists.maptools.org] De la part de Fay Du
Envoyé : mercredi 1 mars 2006 16:02
À : cartoweb-users at lists.maptools.org
Objet : [Cartoweb-users] A question related with using pgdijkstra module


Hi all:
     I have a question related with using pgdijkstra module. The module calculates optimized path node by node. My network is a transportation network, if I have a point somewhere in the area, for example, it can be a car's location from GPS, and the point is not on any edges of the network. What is the quick method to match the point to a node in the network?  Are there any examples somewhere? How does Cartoweb demo match city to a node in its transportation network? I can search the nodes and find the closest one by specifying a searching distance (for example, starting with 100 meters, then increasing by 10 meters if no node find, and giving up is the searching distance reaches 1000). Thanks in advance.
 
Fay
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060301/d00c10f7/attachment.html


More information about the Cartoweb-users mailing list