Changes between Version 48 and Version 49 of Noeud - parcours RHT


Ignore:
Timestamp:
Jan 9, 2012 11:57:34 AM (13 years ago)
Author:
celine
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Noeud - parcours RHT

    v48 v49  
    142142}}} 
    143143 
    144 == Joining ROE with RHT == 
    145 Projection spatiale des obstacles (points) sur le RHT (lignes) avec un buffer de 300 m [[BR]] 
    146 {{{ 
    147 #!sql 
    148 DROP TABLE IF EXISTS rht.rhtvs2_roev2; 
    149 CREATE TABLE rht.rhtvs2_roev2 as ( 
    150         SELECT distinct on (id_roe) id_roe, id_drain, min(distance) as distance, the_geom FROM ( 
    151                SELECT id_roe, id_drain ,CAST(distance(r.the_geom, s.the_geom) as  decimal(15,1)) as distance, s.the_geom  
    152                FROM roe_v2.roe_v2 As s 
    153                INNER JOIN  rht.rhtvs2 r ON ST_DWithin(r.the_geom, s.the_geom,300) 
    154                WHERE s.the_geom IS NOT NULL 
    155                ORDER BY id_roe) AS sub  
    156         GROUP BY id_roe, distance,id_drain, the_geom  ---49269 lines 
    157 );  
    158 alter table rht.rhtvs2_roev2 add column id serial; 
    159 -- mise à jour de la table geometry_columns 
    160 INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") 
    161 SELECT '', 'rht', 'rhtvs2_roev2', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 
    162 FROM rht.rhtvs2_roev2 LIMIT 1; 
    163  
    164 -- creation d'index, clé primaire, et constraintes qui vont bien 
    165 alter table rht.rhtvs2_roev2 add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); 
    166 alter table rht.rhtvs2_roev2 add  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL); 
    167 alter table rht.rhtvs2_roev2 add  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); 
    168 alter table rht.rhtvs2_roev2 ADD CONSTRAINT pk_idroe PRIMARY KEY(id); 
    169 alter table rht.rhtvs2_roev2 drop CONSTRAINT pk_idroe; 
    170 CREATE INDEX indexroev2_rhtvs2 ON rht.rhtvs2_roev2 
    171   USING GIST ( the_geom GIST_GEOMETRY_OPS ); 
    172  
    173  
    174  
    175  
    176 alter table rht.rhtvs2_roev2 add column nbdams integer; 
    177 update rht.rhtvs2_roev2 set nbdams=1; 
    178  
    179 ---Clause group by par id_bdcarthage 
    180 select id_drain, count(nbdams) as nbdams from rht.rht_bdcarthage_roev2 group by id_drain; 
    181  
    182 drop table if exists rht.rht_bdcarthage_roev2_nbdams; 
    183 create table rht.rht_bdcarthage_roev2_nbdams as 
    184 select id_drain, count(nbdams) as nbdams from rht.rht_bdcarthage_roev2 as r group by id_drain; 
    185 }}} 
    186144 
    187145== Joining BDMAP with RHT == 
     
    222180select count(*) from bdmap2009.bdmap_rhtvs2 where a_conserver='t'  ---9020 
    223181select count(*) from bdmap2009.station_geography where id_drain is not null and a_conserver='t' ---9144  (version 1 avec projection spatiale et id_bdcarthage) 
     182}}} 
     183 
     184== Joining ROE with RHT == 
     185Projection spatiale des obstacles (points) sur le RHT (lignes) avec un buffer de 300 m [[BR]] 
     186{{{ 
     187#!sql 
     188DROP TABLE IF EXISTS rht.rhtvs2_roev2; 
     189CREATE TABLE rht.rhtvs2_roev2 as ( 
     190        SELECT distinct on (id_roe) id_roe, id_drain, min(distance) as distance, the_geom FROM ( 
     191               SELECT id_roe, id_drain ,CAST(distance(r.the_geom, s.the_geom) as  decimal(15,1)) as distance, s.the_geom  
     192               FROM roe_v2.roe_v2 As s 
     193               INNER JOIN  rht.rhtvs2 r ON ST_DWithin(r.the_geom, s.the_geom,300) 
     194               WHERE s.the_geom IS NOT NULL 
     195               ORDER BY id_roe) AS sub  
     196        GROUP BY id_roe, distance,id_drain, the_geom  ---49269 lines 
     197);  
     198alter table rht.rhtvs2_roev2 add column id serial; 
     199-- mise à jour de la table geometry_columns 
     200INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") 
     201SELECT '', 'rht', 'rhtvs2_roev2', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 
     202FROM rht.rhtvs2_roev2 LIMIT 1; 
     203 
     204-- creation d'index, clé primaire, et constraintes qui vont bien 
     205alter table rht.rhtvs2_roev2 add CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2); 
     206alter table rht.rhtvs2_roev2 add  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL); 
     207alter table rht.rhtvs2_roev2 add  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 3035); 
     208alter table rht.rhtvs2_roev2 ADD CONSTRAINT pk_idroe PRIMARY KEY(id); 
     209alter table rht.rhtvs2_roev2 drop CONSTRAINT pk_idroe; 
     210CREATE INDEX indexroev2_rhtvs2 ON rht.rhtvs2_roev2 
     211  USING GIST ( the_geom GIST_GEOMETRY_OPS ); 
     212 
     213 
     214 
     215 
     216alter table rht.rhtvs2_roev2 add column nbdams integer; 
     217update rht.rhtvs2_roev2 set nbdams=1; 
     218 
     219---Clause group by par id_bdcarthage 
     220select id_drain, count(nbdams) as nbdams from rht.rht_bdcarthage_roev2 group by id_drain; 
     221 
     222drop table if exists rht.rht_bdcarthage_roev2_nbdams; 
     223create table rht.rht_bdcarthage_roev2_nbdams as 
     224select id_drain, count(nbdams) as nbdams from rht.rht_bdcarthage_roev2 as r group by id_drain; 
    224225}}} 
    225226