bonjour , tu peux essayer cette fonction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| create or replace function xf_route(integer) returns text as $body$
declare coord geometry;
declare route text;
begin
route='MULTIPOINT(';
for coord in select monpoint from matable where numeroroute=$1 order by ordrepoints
loop
route=route||x(coord)||' '||y(coord)||',';
end loop;
route=trim(trailing ',' from route);
route=route||')';
return route;
end;
$body$
language 'plpgsql' |
cette fonction cree une geometrie multipoint (format texte) pour chaque route que tu va utiliser pour remlir table
1 2
| CREATE TABLE tbl_route as
select numeroroute,linefrommultipoint(xf_route(numeroroute)) from matable group by numeroroute |
pour visualiser sous qgis il te faut un champs integer unique donc
alter table tbl_route add constraint num_unique unique (numeroroute )
Partager