Changes between Version 80 and Version 81 of CookBook join ROE_CCM


Ignore:
Timestamp:
May 4, 2010 2:19:14 PM (15 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBook join ROE_CCM

    v80 v81  
    131131-- Création d'un index sur obstacle_referentiel 
    132132 
    133 -- Création de la table correspondance, je rajoute un the_geom a la requete pour pouvoir voir la table dans Qgis  
     133-- Création de la table correspondance (roe_ccm_300), je rajoute un the_geom a la requete pour pouvoir voir la table dans Qgis  
    134134'''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)''' 
    135135 
    136136{{{ 
    137137CREATE 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.correspondance as ( 
     138DROP TABLE IF EXISTS geobs2010.roe_ccm_300; 
     139CREATE TABLE geobs2010.roe_ccm_300 as ( 
    140140        SELECT distinct on (ref_id) ref_id, gid, min(distance) as distance, ref_position_etrs89 as the_geom FROM ( 
    141141               SELECT ref_id, gid ,CAST(distance(r.the_geom, b.ref_position_etrs89) as  decimal(15,1)) as distance ,b.ref_position_etrs89 
     
    152152-- si la commande ci dessus ne marche pas ... 
    153153INSERT 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.correspondance LIMIT 1; 
     154SELECT '', 'geobs2010', 'roe_ccm_300', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 
     155FROM geobs2010.roe_ccm_300 LIMIT 1; 
    156156 
    157157-- creation d'index, clé primaire, et constraintes qui vont bien 
    158 alter table geobs2010.correspondance add column id serial PRIMARY KEY; 
    159 alter table geobs2010.correspondance add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); 
    160 alter table geobs2010.correspondance add  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL); 
    161 alter table geobs2010.correspondance add  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); 
    162  
    163 CREATE INDEX indexgeobscorrespondance ON geobs2010.correspondance 
     158alter table geobs2010.roe_ccm_300 add column id serial PRIMARY KEY; 
     159alter table geobs2010.roe_ccm_300 add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); 
     160alter table geobs2010.roe_ccm_300 add  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL); 
     161alter table geobs2010.roe_ccm_300 add  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); 
     162 
     163CREATE INDEX indexgeobsroe_ccm_300 ON geobs2010.roe_ccm_300 
    164164  USING GIST ( the_geom GIST_GEOMETRY_OPS ); 
    165165}}} 
     
    169169UPDATE geobs2010.obstacle_referentiel set goodproj=FALSE ; 
    170170UPDATE geobs2010.obstacle_referentiel set goodproj=TRUE where ref_id IN ( 
    171 SELECT  ref_id from geobs2010.correspondance); 
     171SELECT  ref_id from geobs2010.roe_ccm_300); 
    172172}}} 
    173173We now have to use, and can display the dams left out in qgis