Changes between Version 16 and Version 17 of CookBook join BDMAP_CCM


Ignore:
Timestamp:
Feb 9, 2010 9:21:58 PM (15 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBook join BDMAP_CCM

    v16 v17  
    54544. Now we will join the new station table '' (with wrong geom but new data) '' to the old table stationsp ''( which has been properly projected by Hélène) '' 
    5555  '' notes '' 
     56 * We first create a table using the AS SELECT command, it is populated with colums from station, and with columns from stationsp2, note the CASE WHEN syntax, which allow to use station.the_geom when stationsp.the_geom is not present in the table. So in practise we use all the old coordinates plus the new ones which have not been verified. 
     57 {{{ 
     58DROP TABLE IF EXISTS stationsp2; 
     59CREATE TABLE stationsp2 WITH OIDS AS( 
     60  select  
     61  station.st_altitude, 
     62  station.st_abcisse, 
     63  station.st_codecsp, 
     64  station.st_codesei, 
     65  station.st_datearret, 
     66  station.st_datecreation, 
     67  station.st_distancesource, 
     68  station.st_distancemer, 
     69  station.st_finalite, 
     70  station.st_imageign, 
     71  station.st_imagedept, 
     72  station.st_lieudit, 
     73  station.st_limites, 
     74  station.st_localisation, 
     75  station.st_longueur, 
     76  station.st_moduleia, 
     77  station.st_cd_naturecourseau, 
     78  station.st_ordonnee, 
     79  station.st_penteign, 
     80  station.st_pkaval, 
     81  station.st_raisremp, 
     82  station.st_sbv, 
     83  station.st_t_janvier, 
     84  station.st_t_juillet, 
     85  station.st_cd_typecourseau, 
     86  station.st_cd_tet, 
     87  station.st_st_id, 
     88  station.st_cm_id, 
     89  station.st_cx_id, 
     90  station.st_th_id, 
     91  station.st_eh_id, 
     92  station.st_uh_id, 
     93  station.st_dt_cre, 
     94  station.st_dt_maj, 
     95  station.st_qi_maj, 
     96  station.st_masseeau, 
     97  stationsp.x, 
     98  stationsp.y, 
     99  stationsp.fnode_, 
     100  stationsp.tnode_, 
     101  stationsp.id_trhyd, 
     102  stationsp.st_id, 
     103  CASE WHEN stationsp.the_geom IS NULL THEN station.the_geom 
     104       ELSE stationsp.the_geom 
     105       END AS the_geom 
     106  FROM stationsp right join bdmap.station on stationsp.st_codecsp=station.st_codecsp) 
     107COMMENT ON TABLE stationsp2 is 'table BDMAP extraite janvier 2010 et mise à jour avec les coordonnées reprojetées par Hélène' 
     108}}} 
     109 
    56110  * the result is displayed there : [screenshot:4], [screenshot:5] 
    57111  * this work corresponds to ticket : #22