Changes between Initial Version and Version 1 of CookBook BDCarthage_UGA


Ignore:
Timestamp:
Oct 3, 2011 11:14:22 AM (14 years ago)
Author:
celine
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBook BDCarthage_UGA

    v1 v1  
     1back to first page[..][[BR]] 
     2back to ["RHT"][[BR]] 
     3 
     4{{{ 
     5drop table  if exists uga2010.id_bdcarthage; 
     6     CREATE TABLE uga2010.id_bdcarthage ( 
     7     id serial PRIMARY KEY, 
     8     id_bdcarth integer, 
     9     uga varchar(25) 
     10     ); 
     11 
     12 --Bretagne 
     13    insert into uga2010.id_bdcarthage(id_bdcarth)  
     14    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     15    join (SELECT ST_Union(f.the_geom) as singlegeom 
     16        FROM uga2010.uga As f where libelle='Bretagne') as sub 
     17    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     18 
     19    UPDATE uga2010.id_bdcarthage set uga='Bretagne' where uga IS NULL -- 27250 lignes 
     20 
     21 --Adour 
     22    insert into uga2010.id_bdcarthage(id_bdcarth)  
     23    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     24    join (SELECT ST_Union(f.the_geom) as singlegeom 
     25        FROM uga2010.uga As f where libelle='Adour') as sub 
     26    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     27 
     28    UPDATE uga2010.id_bdcarthage set uga='Adour' where uga IS NULL -- 27250 lignes 
     29 
     30 --Garonne 
     31    insert into uga2010.id_bdcarthage(id_bdcarth)  
     32    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     33    join (SELECT ST_Union(f.the_geom) as singlegeom 
     34        FROM uga2010.uga As f where libelle='Garonne') as sub 
     35    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     36 
     37    UPDATE uga2010.id_bdcarthage set uga='Garonne' where uga IS NULL -- 27250 lignes 
     38 
     39 --Loire 
     40    insert into uga2010.id_bdcarthage(id_bdcarth)  
     41    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     42    join (SELECT ST_Union(f.the_geom) as singlegeom 
     43        FROM uga2010.uga As f where libelle='Loire') as sub 
     44    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     45 
     46    UPDATE uga2010.id_bdcarthage set uga='Loire' where uga IS NULL -- 27250 lignes 
     47 
     48 --Seine-Normandie 
     49    insert into uga2010.id_bdcarthage(id_bdcarth)  
     50    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     51    join (SELECT ST_Union(f.the_geom) as singlegeom 
     52        FROM uga2010.uga As f where libelle='Seine-Normandie') as sub 
     53    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     54 
     55    UPDATE uga2010.id_bdcarthage set uga='Seine-Normandie' where uga IS NULL -- 27250 lignes 
     56 
     57 
     58 --Corse 
     59    insert into uga2010.id_bdcarthage(id_bdcarth)  
     60    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     61    join (SELECT ST_Union(f.the_geom) as singlegeom 
     62        FROM uga2010.uga As f where libelle='Corse') as sub 
     63    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     64 
     65    UPDATE uga2010.id_bdcarthage set uga='Corse' where uga IS NULL -- 27250 lignes 
     66 
     67 --Artois-Picardie 
     68    insert into uga2010.id_bdcarthage(id_bdcarth)  
     69    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     70    join (SELECT ST_Union(f.the_geom) as singlegeom 
     71        FROM uga2010.uga As f where libelle='Artois-Picardie') as sub 
     72    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     73 
     74    UPDATE uga2010.id_bdcarthage set uga='Artois-Picardie' where uga IS NULL -- 27250 lignes 
     75 
     76 --Rhone-Mediterranee 
     77    insert into uga2010.id_bdcarthage(id_bdcarth)  
     78    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     79    join (SELECT ST_Union(f.the_geom) as singlegeom 
     80        FROM uga2010.uga As f where libelle='Rhone-Mediterranee') as sub 
     81    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     82 
     83    UPDATE uga2010.id_bdcarthage set uga='Rhone-Mediterranee' where uga IS NULL -- 27250 lignes 
     84 
     85 --Rhin 
     86    insert into uga2010.id_bdcarthage(id_bdcarth)  
     87    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     88    join (SELECT ST_Union(f.the_geom) as singlegeom 
     89        FROM uga2010.uga As f where libelle='Rhin') as sub 
     90    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     91 
     92    UPDATE uga2010.id_bdcarthage set uga='Rhin' where uga IS NULL -- 27250 lignes 
     93 
     94--Meuse 
     95    insert into uga2010.id_bdcarthage(id_bdcarth)  
     96    select distinct on (id_bdcarth) id_bdcarth from bd_carthage2011.troncon_hydrographique r 
     97    join (SELECT ST_Union(f.the_geom) as singlegeom 
     98        FROM uga2010.uga As f where libelle='Meuse') as sub 
     99    ON ST_Intersects(sub.singlegeom,r.the_geom); 
     100 
     101    UPDATE uga2010.id_bdcarthage set uga='Meuse' where uga IS NULL -- 27250 lignes 
     102}}}