Changes between Version 80 and Version 81 of CookBook join ROE_CCM
- Timestamp:
- May 4, 2010 2:19:14 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBook join ROE_CCM
v80 v81 131 131 -- Création d'un index sur obstacle_referentiel 132 132 133 -- Création de la table correspondance , je rajoute un the_geom a la requete pour pouvoir voir la table dans Qgis133 -- Création de la table correspondance (roe_ccm_300), je rajoute un the_geom a la requete pour pouvoir voir la table dans Qgis 134 134 '''La distance de projection entre la CCM et la base geobs est choisie à : 300 m (comme pour l'extraction des données BDMAP sur la CCM)''' 135 135 136 136 {{{ 137 137 CREATE INDEX indexgeobs ON geobs2010.obstacle_referentiel USING GIST (ref_position_etrs89 GIST_GEOMETRY_OPS); 138 DROP TABLE IF EXISTS geobs2010. correspondance;139 CREATE TABLE geobs2010. correspondanceas (138 DROP TABLE IF EXISTS geobs2010.roe_ccm_300; 139 CREATE TABLE geobs2010.roe_ccm_300 as ( 140 140 SELECT distinct on (ref_id) ref_id, gid, min(distance) as distance, ref_position_etrs89 as the_geom FROM ( 141 141 SELECT ref_id, gid ,CAST(distance(r.the_geom, b.ref_position_etrs89) as decimal(15,1)) as distance ,b.ref_position_etrs89 … … 152 152 -- si la commande ci dessus ne marche pas ... 153 153 INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") 154 SELECT '', 'geobs2010', ' correspondance', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom)155 FROM geobs2010. correspondanceLIMIT 1;154 SELECT '', 'geobs2010', 'roe_ccm_300', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 155 FROM geobs2010.roe_ccm_300 LIMIT 1; 156 156 157 157 -- creation d'index, clé primaire, et constraintes qui vont bien 158 alter table geobs2010. correspondanceadd column id serial PRIMARY KEY;159 alter table geobs2010. correspondanceadd CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2);160 alter table geobs2010. correspondanceadd CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL);161 alter table geobs2010. correspondanceadd CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035);162 163 CREATE INDEX indexgeobs correspondance ON geobs2010.correspondance158 alter table geobs2010.roe_ccm_300 add column id serial PRIMARY KEY; 159 alter table geobs2010.roe_ccm_300 add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); 160 alter table geobs2010.roe_ccm_300 add CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL); 161 alter table geobs2010.roe_ccm_300 add CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); 162 163 CREATE INDEX indexgeobsroe_ccm_300 ON geobs2010.roe_ccm_300 164 164 USING GIST ( the_geom GIST_GEOMETRY_OPS ); 165 165 }}} … … 169 169 UPDATE geobs2010.obstacle_referentiel set goodproj=FALSE ; 170 170 UPDATE geobs2010.obstacle_referentiel set goodproj=TRUE where ref_id IN ( 171 SELECT ref_id from geobs2010. correspondance);171 SELECT ref_id from geobs2010.roe_ccm_300); 172 172 }}} 173 173 We now have to use, and can display the dams left out in qgis