Changes between Version 94 and Version 95 of CLC Join


Ignore:
Timestamp:
Jun 11, 2010 9:01:38 AM (15 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CLC Join

    v94 v95  
    10831083ALTER TABLE clc.surf_area ADD CONSTRAINT c_pk_gid_surf_area PRIMARY KEY (gid); 
    10841084}}} 
     1085{{{ 
     1086DROP TABLE IF EXISTS clc.surf_area_final; 
     1087CREATE TABLE clc.surf_area_final AS(  
     1088SELECT  
     1089        r.gid, 
     1090        area/1e6 as catchment_area, 
     1091        CASE WHEN artificial_surfaces_11_13 IS NOT NULL THEN artificial_surfaces_11_13/1e6 
     1092        ELSE 0 
     1093        END AS artificial_surfaces_11_13, 
     1094        CASE WHEN artificial_vegetated_14 IS NOT NULL THEN artificial_vegetated_14/1e6  
     1095        ELSE 0 
     1096        END AS artificial_vegetated_14, 
     1097        CASE WHEN arable_land_21 IS NOT NULL THEN arable_land_21/1e6  
     1098        ELSE 0 
     1099        END AS arable_land_21, 
     1100        CASE WHEN permanent_crops_22 IS NOT NULL THEN permanent_crops_22/1e6  
     1101        ELSE 0 
     1102        END AS permanent_crops_22, 
     1103        CASE WHEN pastures_23 IS NOT NULL THEN pastures_23/1e6  
     1104        ELSE 0 
     1105        END AS pastures_23, 
     1106        CASE WHEN heterogeneous_agricultural_24 IS NOT NULL THEN heterogeneous_agricultural_24/1e6 
     1107        ELSE 0 
     1108        END AS heterogeneous_agricultural_24, 
     1109        CASE WHEN forest_31 IS NOT NULL THEN forest_31/1e6  
     1110        ELSE 0 
     1111        END AS forest_31, 
     1112        CASE WHEN natural_32_33 IS NOT NULL THEN natural_32_33/1e6  
     1113        ELSE 0 
     1114        END AS natural_32_33, 
     1115        CASE WHEN wetlands_4 IS NOT NULL THEN wetlands_4/1e6  
     1116        ELSE 0 
     1117        END AS wetlands_4, 
     1118        CASE WHEN inland_waterbodies_51 IS NOT NULL THEN inland_waterbodies_51 /1e6  
     1119        ELSE 0 
     1120        END AS inland_waterbodies_51, 
     1121        CASE WHEN  marine_water_52 IS NOT NULL THEN marine_water_52/1e6  
     1122        ELSE 0 
     1123        END AS marine_water_52, 
     1124        c.wso1_id, 
     1125        c.the_geom       
     1126FROM clc.surf_area p 
     1127JOIN ccm21.catchments c ON c.gid=p.gid 
     1128JOIN ccm21.riversegments r on r.wso1_id=c.wso1_id 
     1129); 
     1130}}} 
    10851131saving the result of the request 
    10861132{{{