| 67 | |
| 68 | Creating local tables for Britany (to enhance speed and allow fast testing and displaying in Qgis |
| 69 | {{{ |
| 70 | -- I'm adding some original data tables restricted for an area for Qgis easy use |
| 71 | -- extraction of a clc table for Britany |
| 72 | DROP TABLE IF EXISTS clc.clc00_v2_Bretagne; |
| 73 | CREATE TABLE clc.clc00_v2_Bretagne AS |
| 74 | SELECT * FROM clc.clc00_v2_europe where gid IN ( |
| 75 | SELECT gid FROM clc.clc00_v2_europe clc JOIN |
| 76 | (SELECT the_geom FROM france.region where code_reg='53') as sub |
| 77 | ON ST_Contains(sub.the_geom,clc.the_geom)); |
| 78 | ALTER TABLE clc.clc00_v2_Bretagne ADD CONSTRAINT c_pk_gid PRIMARY KEY (gid); |
| 79 | INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") |
| 80 | SELECT '', 'clc', 'clc00_v2_Bretagne', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) |
| 81 | FROM clc.clc00_v2_europe LIMIT 1; |
| 82 | |
| 83 | -- Creating a table for riversegments Bretagne |
| 84 | |
| 85 | DROP TABLE IF EXISTS ccm21.riversegments_Bretagne; |
| 86 | CREATE TABLE ccm21.riversegments_Bretagne AS |
| 87 | SELECT * FROM ccm21.riversegments |
| 88 | WHERE wso_id IN (SELECT wso_id FROM france.wso WHERE area='Bretagne'); |
| 89 | ALTER TABLE ccm21.riversegments_Bretagne ADD CONSTRAINT c_pk_gid_riversegments_Bretagne PRIMARY KEY (gid); |
| 90 | INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") |
| 91 | SELECT '', 'ccm21', 'riversegments_Bretagne', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) |
| 92 | FROM ccm21.riversegments_Bretagne LIMIT 1; |
| 93 | |
| 94 | -- creating a table for catchments Bretagne. |
| 95 | DROP TABLE IF EXISTS ccm21.catchments_Bretagne; |
| 96 | CREATE TABLE ccm21.catchments_Bretagne AS |
| 97 | SELECT * FROM ccm21.catchments |
| 98 | WHERE wso_id IN (SELECT wso_id FROM france.wso WHERE area='Bretagne'); |
| 99 | ALTER TABLE ccm21.catchments_Bretagne ADD CONSTRAINT c_pk_gid_catchments_Bretagne PRIMARY KEY (gid); |
| 100 | INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") |
| 101 | SELECT '', 'ccm21', 'catchments_Bretagne', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) |
| 102 | FROM ccm21.catchments_Bretagne LIMIT 1; |
| 103 | }}} |