Changes between Version 39 and Version 40 of CookBook join BDMAP_CCM v2


Ignore:
Timestamp:
Nov 9, 2010 3:31:57 PM (14 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBook join BDMAP_CCM v2

    v39 v40  
    138138DROP TABLE IF EXISTS bd_map_bd_carthage; 
    139139CREATE TABLE bd_map_bd_carthage as ( 
    140         SELECT distinct on (st_codecsp) st_codecsp, gid, min(distance) as distance, the_geom FROM ( 
    141                SELECT st_codecsp, gid ,CAST(distance(r.the_geom, s.the_geom) as  decimal(15,1)) as distance,s.the_geom  
     140               SELECT st_codecsp, n.distance_source,n.distance_mer,n.strahler ,a.id_trhyd ,CAST(distance(a.the_geom, s.the_geom) as  decimal(15,1)) as distance,s.the_geom  
    142141               FROM stationsp2 As s 
    143                INNER JOIN  hylcov_arc a ON ST_DWithin(a.the_geom, s.the_geom,300) 
     142               INNER JOIN hylcov_arc a ON ST_DWithin(a.the_geom, s.the_geom,300) 
     143                LEFT JOIN noeud_troncon_final n ON a.id_som_f::numeric = n.id_bdcarthage 
    144144               WHERE s.the_geom IS NOT NULL 
    145                ORDER BY st_codecsp) AS sub  
    146         GROUP BY st_codecsp, distance,gid, the_geom 
     145               ORDER BY st_codecsp 
     146 
    147147); 
    148 -- ajout d'une clé primaire pour Qgis 
    149 alter table bd_map_bd_carthage add column id serial; 
     148alter table  bd_map_bd_carthage add column id serial; 
    150149-- mise à jour de la table geometry_columns 
    151150INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") 
    152 SELECT '', '', 'bd_map_bd_carthage', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 
     151SELECT '', 'public', 'bd_map_bd_carthage', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 
    153152FROM bd_map_bd_carthage LIMIT 1; 
    154153