Changes between Version 39 and Version 40 of CookBook join BDMAP_CCM v2
- Timestamp:
- Nov 9, 2010 3:31:57 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBook join BDMAP_CCM v2
v39 v40 138 138 DROP TABLE IF EXISTS bd_map_bd_carthage; 139 139 CREATE 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 142 141 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 144 144 WHERE s.the_geom IS NOT NULL 145 ORDER BY st_codecsp ) AS sub146 GROUP BY st_codecsp, distance,gid, the_geom 145 ORDER BY st_codecsp 146 147 147 ); 148 -- ajout d'une clé primaire pour Qgis 149 alter table bd_map_bd_carthage add column id serial; 148 alter table bd_map_bd_carthage add column id serial; 150 149 -- mise à jour de la table geometry_columns 151 150 INSERT 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)151 SELECT '', 'public', 'bd_map_bd_carthage', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom) 153 152 FROM bd_map_bd_carthage LIMIT 1; 154 153