Changes between Version 20 and Version 21 of Noeud - parcours RHT


Ignore:
Timestamp:
Jan 5, 2012 10:20:16 AM (13 years ago)
Author:
celine
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Noeud - parcours RHT

    v20 v21  
    163163}}} 
    164164 
     165== Joining BDMAP with RHT == 
     166Projection spatiale des points BDMAP sur la couche station_geography (bdmap2009). 
     167{{{ 
     168#sql! 
     169-- creation de la table bdmap2009.bdmap_rhtvs2, je rajoute un the_geom a la requete pour pouvoir voir la table dans Qgis   
     170DROP TABLE IF EXISTS bdmap2009.bdmap_rhtvs2; 
     171CREATE TABLE bdmap2009.bdmap_rhtvs2 as ( 
     172        SELECT distinct on (st_codecsp) st_codecsp, id_drain, min(distance) as distance, the_geom FROM ( 
     173               SELECT st_codecsp, id_drain ,CAST(distance(r.the_geom, s.the_geom) as  decimal(15,1)) as distance,s.the_geom  
     174               FROM bdmap2009.stationsp2 As s 
     175               INNER JOIN  rht.rhtvs2 r ON ST_DWithin(r.the_geom, s.the_geom,300) 
     176               WHERE s.the_geom IS NOT NULL 
     177               ORDER BY st_codecsp) AS sub  
     178        GROUP BY st_codecsp, distance,id_drain, the_geom 
     179); 
     180alter table bdmap2009.bdmap_rhtvs2 add column id serial; 
     181-- mise à jour de la table geometry_columns 
     182INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") 
     183SELECT '', 'bdmap2009', 'bdmap_rhtvs2', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 
     184FROM bdmap2009.bdmap_rhtvs2 LIMIT 1; 
     185 
     186-- creation d'index, clé primaire, et constraintes qui vont bien 
     187alter table bdmap2009.bdmap_rhtvs2 add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); 
     188alter table bdmap2009.bdmap_rhtvs2 add  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL); 
     189alter table bdmap2009.bdmap_rhtvs2 add  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); 
     190alter table bdmap2009.bdmap_rhtvs2 ADD CONSTRAINT pk_id PRIMARY KEY(id); 
     191CREATE INDEX indexbdmap_rht ON bdmap2009.bdmap_rhtvs2 
     192  USING GIST ( the_geom GIST_GEOMETRY_OPS ); 
     193}}} 
     194 
    165195 
    166196#A FINIR ci-dessous !!