| 116 | {{{ |
| 117 | -- creating a table for catchments france |
| 118 | DROP TABLE IF EXISTS ccm21.catchments_france; |
| 119 | CREATE TABLE ccm21.catchments_france AS |
| 120 | SELECT * FROM ccm21.catchments |
| 121 | WHERE wso_id IN (SELECT wso_id FROM france.wso WHERE area='france'); |
| 122 | |
| 123 | ALTER TABLE ccm21.catchments_france ADD CONSTRAINT c_pk_gid_catchments_france PRIMARY KEY (gid); |
| 124 | INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") |
| 125 | SELECT '', 'ccm21', 'catchments_france', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) |
| 126 | FROM ccm21.catchments_france LIMIT 1; |
| 127 | |
| 128 | alter table ccm21.catchments_france add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); |
| 129 | alter table ccm21.catchments_france add CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL); |
| 130 | alter table ccm21.catchments_france add CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); |
| 131 | CREATE INDEX index_catchments_france ON ccm21.catchments_france |
| 132 | USING GIST ( the_geom GIST_GEOMETRY_OPS ); |
| 133 | CREATE INDEX indexcatchmentsfrance_wso1_id |
| 134 | ON ccm21.catchments |
| 135 | USING btree |
| 136 | (wso1_id); |