wiki:europe.wso1

Version 4 (modified by celine, 14 years ago) (diff)

--

back to first page ..
back to CookBook Eda
back to Limites administratives Europe back to Cookbook CCM21_Europe

Pour la France mettre : France (gid=11)+Andorre (gid=2) +Monaco (gid=27) ?

drop table  if exists europe.wso1;
     CREATE TABLE europe.wso1 (
     id serial PRIMARY KEY,
     wso_id integer,
     wso1_id integer,
     area varchar(12)
     );

---- Ajout des UGA France
insert into europe.wso1 (wso_id, wso1_id, area) select wso_id, wso1_id, uga from  uga2010.wso1

CREATE INDEX europe_wso1_id
  ON europe.wso1
  (wso1_id);

#TODO A finir la suite...

--WRB Western River Basin
    insert into europe.wso(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_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.wso1 set area='Western' where area IS NULL; --118 lines

--Anglian
    insert into europe.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_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.wso1 set area='Anglian' where area IS NULL;  --69 lines

--Sardinia
    insert into europe.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_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.wso1 set area='Sardinia' where area IS NULL; --209 lines

--Swedish ?
    insert into europe.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_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.wso1 set area='Swedish' where area IS NULL; --121 lines

--Elbe ?
    insert into europe.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_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.wso1 set area='Elbe' where area IS NULL; --18 lines
---- Cas Espagne à voir !!! beaucoup trop de segments retenus dans Spain_Atl
---Spain-Atl
insert into europe.wso1(wso_id, wso1_id) 
(select wso_id, wso1_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.wso1 set area='Spain_Atl' where area IS NULL;  --348 lines
insert into europe.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_id from ccm21.riversegments r where wso_id='342310'
        UPDATE europe.wso1 set area='SeineNormandie' where area IS NULL;
insert into europe.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_id from ccm21.riversegments r where wso_id='353376'
        UPDATE europe.wso1 set area='Bretagne' where area IS NULL;
delete from europe.wso where wso_id='442529'
insert into europe.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_id from ccm21.riversegments r where wso_id in ('383','2005','8639','38619');
     UPDATE europe.wso1 set area='Elbe' where area IS NULL;
delete from europe.wso1 where wso_id='130439'
delete from europe.wso where wso_id='129487' and area='France'
delete from europe.wso where wso_id='442353' and area='France'

---uga2010
insert into uga2010.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_id from ccm21.riversegments r where wso_id='353376'
        UPDATE uga2010.wso1 set uga='Bretagne' where uga IS NULL;
insert into uga2010.wso1(wso_id, wso1_id) 
    select distinct on (wso_id, wso1_id)  wso_id, wso1_id from ccm21.riversegments r where wso_id='342310'
        UPDATE uga2010.wso1 set uga='SeineNormandie' where uga IS NULL;
delete from uga2010.wso where wso_id='442529'
delete from uga2010.wso1 where wso_id='130439'