[Cartoweb-users] IGN GEOROUTE and PGDIJKSTRA

TECHER David davidtecher at yahoo.fr
Wed Aug 30 10:35:40 EDT 2006


Hi zze-SIGALE,

thanks 4 your reply

I made some think like

Perhaps if a French user can help me it could be usefull

I made a mistake...but what I don't know

begin;
/*
   Ajouter les colonnes adéquates
*/
alter table troncon_route add column source_id int4;
alter table troncon_route add column target_id int4;
alter table troncon_route add column edge_id int4;
/*
   Mettre à jour le srid=1 sinon pgdijkstra gueule 8-(
*/
select updategeometrysrid('troncon_route','the_geom',-1);




SELECT assign_vertex_id('troncon_route',0.1);--(select
min(length(the_geom)) from troncon_route));
end;



begin;
/*
   créer un table temporaire pour éliminer les doublons "(source,target)"
*/
create temporary table troncon_route_tmp as select * from troncon_route
where gid  in (select gid from (select DISTINCT on (source_id,
target_id) source_id, gid from troncon_route) as doublon);
/*
   Vider la table cible
*/
delete from troncon_route;
/*
   Ok...On fait le dump
*/
insert into troncon_route (select * from troncon_route_tmp);
/*
   Ok...Je crée mon graphe
*/
SELECT create_graph_tables('troncon_route', 'int4');

SELECT update_cost_from_distance('troncon_route');
/*
    Tout ce qui est à "double sens" je le garde
*/
update troncon_route_edges set reverse_cost=cost;
/*
    On s'occupe des voies à sens direct ou inverse
*/
update troncon_route set source_id=target_id where sens='Sens inverse';

update troncon_route_edges set
source=target,target=source,reverse_cost=reverse_cost+7000000
 where      
    source in (select distinct id from troncon_route_vertices where
geom_id in (select distinct source_id from troncon_route where
sens='Sens inverse'))
and
    target in (select distinct id from troncon_route_vertices where
geom_id in (select distinct target_id from troncon_route where
sens='Sens inverse'));
;

update troncon_route_edges set 
reverse_cost=reverse_cost+7000000
 where      
    source in (select distinct id from troncon_route_vertices where
geom_id in (select distinct source_id from troncon_route where
sens='Sens direct'))
and
    target in (select distinct id from troncon_route_vertices where
geom_id in (select distinct target_id from troncon_route where
sens='Sens direct'));


end;


zze-SIGALE PORTANERI F ext RD-BIZZ-SOP a écrit :

>Hi,
>
>I guess that after having call create_graph_tables() on 'troncon_route', you have to update the cost and reverse_cost columns of your 'troncon_route_edges' table accordingly :
>
>For instance, you may set initially reverse_cost = cost for all entries of troncon_route_edges' table, then you can do something like:
>	- if sens = "Sens direct"  then reverse_cost = -1 
>	- if sens = "Sens inverse" then cost = -1 
>
>Hope it helps,
>Franck
>
>
>-----Message d'origine-----
>De : cartoweb-users-bounces at lists.maptools.org [mailto:cartoweb-users-bounces at lists.maptools.org] De la part de TECHER David
>Envoyé : mercredi 30 août 2006 06:38
>À : cartoweb-users at lists.maptools.org
>Objet : [Cartoweb-users] IGN GEOROUTE and PGDIJKSTRA
>
>Hi CartoWeb Team,
>
>I'm trying to use the data from GEOROUTE from IGN France
>
>I have a table 'troncon_route":
>
>On my network, I have a oriented graph with a column name "sens" wich can have 3 possibilties:
>
>- "Double sens" two-way
>
>- "Sens direct " one-way
>
>- "Sens inverse" the opposite direction of my one-way! => from the target to the source
>
>Has someones any idea on how to solve the problem!
>
>Any helps could be very appreciated!
>
>I've already read the doc from pgdikstra!
>
>Thanks!
>
>--david;
>
>	
> p4.vert.ukl.yahoo.com uncompressed Wed Aug 30 04:27:01 GMT 2006 
>	
>		
>___________________________________________________________________________
>Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! 
>Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. 
>http://fr.answers.yahoo.com 
>
>_______________________________________________
>Cartoweb-users mailing list
>Cartoweb-users at lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/cartoweb-users
>
>  
>


	
 p3.vert.ukl.yahoo.com uncompressed Wed Aug 30 14:27:00 GMT 2006 
	
		
___________________________________________________________________________ 
Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! 
Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. 
http://fr.answers.yahoo.com 



More information about the Cartoweb-users mailing list