Changes between Version 17 and Version 18 of Meuse dbeel


Ignore:
Timestamp:
Jun 16, 2014 2:55:40 PM (11 years ago)
Author:
laura
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Meuse dbeel

    v17 v18  
    12441244 
    12451245}}} 
     1246 
     1247 
     1248{{{#!sql 
     1249 
     1250--------------------------------------------------------------------------------------------------------------- 
     1251---------------- Table station_CCM_500 france_Belge_Meuse---------------- 
     1252--------------------------------------------------------------------------------------------------------------- 
     1253 
     1254ALTER TABLE onema.station_onema RENAME COLUMN st_id TO site; 
     1255ALTER TABLE belge.stationdbeel ALTER COLUMN site TYPE bigint; 
     1256ALTER TABLE onema.station_onema ALTER COLUMN site TYPE character varying; 
     1257 
     1258DROP TABLE IF EXISTS dbeel.meuse_stations_ccm_500; 
     1259CREATE TABLE dbeel.meuse_stations_ccm_500 as ( 
     1260         SELECT n.site, n.gid, n.wso1_id, min(n.distance) as distance, n.the_geom FROM  
     1261                (   
     1262                SELECT site, gid, wso1_id, distance, s.the_geom  
     1263                FROM dbeel.observation_places_CCM_500 s 
     1264                join belge.stationdbeel o ON o.op_id=s.op_id --516 lignes 
     1265                union ALL 
     1266                        SELECT p.site, gid, m.wso1_id, m.distance, p.the_geom FROM ( 
     1267                               select o.gid, o.wso1_id, o.op_id,  o.distance from dbeel.observation_places_CCM_500 o 
     1268                               JOIN europe.wso1 e ON o.wso1_id=e.wso1_id where area='Meuse') m 
     1269                join onema.station_onema p ON p.op_id=m.op_id ) n --901 lignes 
     1270                 
     1271         WHERE n.the_geom IS NOT NULL   
     1272         GROUP BY n.site, n.gid, n.wso1_id, distance, n.the_geom -- 901 
     1273         order by n.wso1_id, n.site  
     1274); 
     1275select * from dbeel.meuse_stations_ccm_500 
     1276        
     1277alter table dbeel.meuse_stations_ccm_500 add column id serial; 
     1278-- mise à jour de la table geometry_columns 
     1279INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") 
     1280SELECT '', 'dbeel', 'meuse_stations_ccm_500', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 
     1281FROM dbeel.meuse_stations_ccm_500 LIMIT 1; 
     1282 
     1283-- creation d'index, clé primaire, et constraintes qui vont bien 
     1284alter table dbeel.meuse_stations_ccm_500 add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); 
     1285alter table dbeel.meuse_stations_ccm_500 add  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL); 
     1286alter table dbeel.meuse_stations_ccm_500 add  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); 
     1287alter table dbeel.meuse_stations_ccm_500 ADD CONSTRAINT pk_id PRIMARY KEY(id); 
     1288CREATE INDEX indexmeuse_FB_ccm_500 ON dbeel.meuse_stations_ccm_500 
     1289  USING GIST ( the_geom GIST_GEOMETRY_OPS ); 
     1290 
     1291}}}