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