Version 6 (modified by cedric, 15 years ago) (diff) |
---|
This page describes the join of ccm21.catchments with the clc
-- Un essai sur la Bretagne pour voir DROP TABLE IF EXISTS clc.clipped_bretagne; CREATE TABLE clc.clipped_bretagne AS SELECT intersected.clcgid, intersected.gid, clipped_geom FROM (SELECT clc.gid as clcgid, c.gid, ST_Multi(ST_Intersection(clc.the_geom, c.the_geom)) AS clipped_geom FROM clc.clc00_v2_europe clc INNER JOIN ccm21.catchments c ON ST_Intersects (c.the_geom,clc.the_geom) WHERE c.wso_id IN (SELECT wso_id FROM france.wso WHERE area='Bretagne') AND substring(code_00 from 1 for 1)='1') AS intersected;--3721 lines ALTER TABLE clc.clipped_bretagne add column id serial PRIMARY KEY; -- ajout dans la table geometry_columns pour référencement rapide sous Qgis INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") SELECT '', 'clc', 'clipped_bretagne', 'the_geom', ST_CoordDim(clipped_geom), ST_SRID(clipped_geom), MULTIPOLYGON FROM clc.clipped_bretagne LIMIT 1; -- il ne s'affiche pas... essai réduit OK DROP TABLE IF EXISTS clc.clipped_bretagne; CREATE TABLE clc.clipped_bretagne AS SELECT clc.gid as clcgid,c.gid, clc.the_geom FROM clc.clc00_v2_europe clc INNER JOIN ccm21.catchments c ON ST_Intersects (c.the_geom,clc.the_geom) WHERE c.wso_id IN (SELECT wso_id FROM france.wso WHERE area='Bretagne') AND substring(code_00 from 1 for 1)='1'; ALTER TABLE clc.clipped_bretagne add column id serial PRIMARY KEY; -- la requete globale SELECT intersected.clcgid, intersected.gid, clipped_geom FROM (SELECT clc.gid as clcgid, c.gid, ST_Intersection(clc.the_geom, c.the_geom) AS clipped_geom FROM clc.clc00_v2_europe clc INNER JOIN ccm21.catchments c ON ST_Intersects (c.the_geom,clc.the_geom) where substring(code_00 from 1 for 1)='1' ) AS intersected;
Attachments (3)
- ticket#56fin.sql (4.8 KB) - added by cedric 15 years ago.
- ticket#56.sql (15.6 KB) - added by cedric 15 years ago.
- ticket#56fin.2.sql (4.8 KB) - added by cedric 15 years ago.
Download all attachments as: .zip