wiki:Cookbook CCM21_Europe

Version 1 (modified by celine, 15 years ago) (diff)

--

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

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

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

----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

----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='Spain' where area IS NULL


CREATE INDEX europe_wso_id
  ON france.wso
  (wso_id);