Changes between Version 2 and Version 3 of CookBook join RHT-BDMAP
- Timestamp:
- May 20, 2011 10:49:18 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBook join RHT-BDMAP
v2 v3 9 9 10 10 Problème de projections !!! A vérifier en cours ! 11 {{{ 11 12 -- creation de la table bdmap_rht, je rajoute un the_geom a la requete pour pouvoir voir la table dans Qgis 12 13 DROP TABLE IF EXISTS rht.bdmap_rht; 13 14 CREATE TABLE rht.bdmap_rht as ( 14 SELECT distinct on (st_codecsp) st_codecsp, gid, min(distance) as distance, the_geom FROM (15 SELECT st_codecsp, gid,CAST(distance(r.the_geom, s.the_geom) as decimal(15,1)) as distance,s.the_geom15 SELECT distinct on (st_codecsp) st_codecsp, id_drain, min(distance) as distance, the_geom FROM ( 16 SELECT st_codecsp, id_drain ,CAST(distance(r.the_geom, s.the_geom) as decimal(15,1)) as distance,s.the_geom 16 17 FROM bd_map.stationsp2 As s 17 INNER JOIN rht.r iversegmentsr ON ST_DWithin(r.the_geom, s.the_geom,300)18 INNER JOIN rht.rht r ON ST_DWithin(r.the_geom, s.the_geom,300) 18 19 WHERE s.the_geom IS NOT NULL 19 20 ORDER BY st_codecsp) AS sub 20 GROUP BY st_codecsp, distance, gid, the_geom21 GROUP BY st_codecsp, distance,id_drain, the_geom 21 22 ); 22 23 alter table rht.bdmap_rht add column id serial; … … 33 34 CREATE INDEX indexbdmap_rht ON rht.bdmap_rht 34 35 USING GIST ( the_geom GIST_GEOMETRY_OPS ); 35 36 }}}