back to first page [..][[BR]] back to ["CookBook Eda"][[BR]] back to ["Limites administratives Europe"][[BR]] Pour la France mettre : France (gid=11)+Andorre (gid=2) +Monaco (gid=27) ?[[BR]] {{{ create schema europe; drop table if exists europe.wso; CREATE TABLE europe.wso ( id serial PRIMARY KEY, wso_id integer, area varchar(12) ); ----France insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM europe.limiteeurope As f where gid='11'or gid='2'or gid='27' ) as sub ON ST_Intersects(sub.singlegeom,r.the_geom); UPDATE europe.wso set area='France' where area IS NULL; --680 sea nodes select * from ccm21.riversegments where wso_id in (select wso_id from europe.wso where area='France');--170734 lines (with france.departement 170703 lines) ----Germany insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM europe.limiteeurope As f where gid='12') as sub ON ST_Intersects(sub.singlegeom,r.the_geom); UPDATE europe.wso set area='Germany' where area IS NULL; --234 sea nodes ----Spain (+Gibraltar) insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM europe.limiteeurope As f where gid='37' or gid='13') as sub ON ST_Intersects(sub.singlegeom,r.the_geom); UPDATE europe.wso set area='Spain' where area IS NULL; --863 lines ----Italy (+San Marino) insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM europe.limiteeurope As f where gid='19' or gid='33') as sub ON ST_Intersects(sub.singlegeom,r.the_geom); UPDATE europe.wso set area='Italy' where area IS NULL; --1490 lines ----Ireland insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM europe.limiteeurope As f where gid='17') as sub ON ST_Intersects(sub.singlegeom,r.the_geom); UPDATE europe.wso set area='Ireland' where area IS NULL; --505 lines ----Sweden insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM europe.limiteeurope As f where gid='38') as sub ON ST_Intersects(sub.singlegeom,r.the_geom); UPDATE europe.wso set area='Sweden' where area IS NULL; --998 lines ----UK insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM europe.limiteeurope As f where gid='40') as sub ON ST_Intersects(sub.singlegeom,r.the_geom); UPDATE europe.wso set area='UK' where area IS NULL; ---- Ajout des UGA insert into europe.wso (wso_id,area) select wso_id,uga from uga2010.wso CREATE INDEX europe_wso_id ON europe.wso (wso_id); }}} {{{ ---Spain-Atl insert into europe.wso(wso_id) (select wso_id from europe.wso where area='Spain' except (select wso_id from europe.wso where area='France')) intersect (select wso_id from ccm21.seaoutlets where area_cd='A1'); UPDATE europe.wso set area='Spain_Atl' where area IS NULL; --348 lines --WRB Western River Basin insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT the_geom FROM european_wise2008.rbd_f1v3 As f where gid=39) as sub ON ST_Intersects(sub.the_geom,r.the_geom); UPDATE europe.wso set area='Western' where area IS NULL; --118 lines --Anglian insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT the_geom FROM european_wise2008.rbd_f1v3 As f where gid=200) as sub ON ST_Intersects(sub.the_geom,r.the_geom); UPDATE europe.wso set area='Anglian' where area IS NULL; --69 lines --Sardinia insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT the_geom FROM european_wise2008.rbd_f1v3 As f where gid=85) as sub ON ST_Intersects(sub.the_geom,r.the_geom); UPDATE europe.wso set area='Sardinia' where area IS NULL; --209 lines --Swedish ? insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT the_geom FROM european_wise2008.rbd_f1v3 As f where gid=166) as sub ON ST_Intersects(sub.the_geom,r.the_geom); UPDATE europe.wso set area='Swedish' where area IS NULL; --121 lines --Elbe ? insert into europe.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT the_geom FROM european_wise2008.rbd_f1v3 As f where gid=208) as sub ON ST_Intersects(sub.the_geom,r.the_geom); UPDATE europe.wso set area='Elbe' where area IS NULL; --18 lines }}} {{{ ---Sauvegarde des données D: cd D:\CelineJouanin\backup C:\"Program Files"\PostgreSQL\8.4\bin\pg_dump -U postgres -p 5433 -t geobs2010.obstacle_referenciel_projccm eda2.0> geobs2010.obstacle_referenciel_projccm.sql }}} Comparaison europe.wso et rbd_f1v3.bassin_pose {{{ select cum_len_sea, up_area, shree, scheid, distance_relative, c_area, distance_source, catchment_area from ccm21.riversegments r inner join europe.wso e on e.wso_id=r.wso_id where e.area='Sardinia' select cum_len_sea, up_area, shree, scheid, distance_relative, c_area, distance_source, catchment_area from ccm21.riversegments r inner join rbd_f1v3.bassin_pose e on e.wso_id=r.wso_id where e.emu='Sardinia' select * from rbd_f1v3.bassin_pose e where e.emu='Anglian' select * from europe.wso w where w.area='Sardinia' select * from europe.wso w left join rbd_f1v3.bassin_pose b on b.wso_id=w.wso_id where w.area='Elbe' select * from rbd_f1v3.bassin_pose b right join europe.wso w on b.wso_id=w.wso_id where emu='Sardinia' }}} ---63 wso_id qui notés Anglian et UK dans europe.wso --> OK {{{ select * from rbd_f1v3.bassin_pose b right join europe.wso w on b.wso_id=w.wso_id where emu='Anglian' and area='UK' }}} ---6 wso_id qui doivent être rajouté dans europe.wso pour l'Elbe {{{ select * from rbd_f1v3.bassin_pose b right join europe.wso w on b.wso_id=w.wso_id where emu='Elbe' }}} {{{ insert into europe.wso(wso_id) values ('383'),('2005'),('8639'),('38619'),('38481'),('2020'); UPDATE europe.wso set area='Elbe' where area IS NULL; }}} Problème : ||Nb lignes dans||riversegments_uga avec europe.wso||CCM sous R uga2010.wso|| ||Bretagne||2115||2035|| ||Corse||4839||4836|| ||Garonne||13219||13223|| ||RMC||91635||91548|| ||!SeineNormandie||7415||7413|| {{{ select * from uga2010.wso b left join europe.wso w on b.wso_id=w.wso_id where uga='SeineNormandie' select count(b.wso_id), b.wso_id from uga2010.wso b left join europe.wso w on b.wso_id=w.wso_id where uga='SeineNormandie' group by b.wso_id order by count(b.wso_id) }}} ||!SeineNormandie||332670, 337665||A mettre dans area France||