Changes between Version 24 and Version 25 of CookBook join ROE_CCMv2
- Timestamp:
- Nov 23, 2010 5:34:18 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBook join ROE_CCMv2
v24 v25 182 182 {{{ 183 183 #!sql 184 185 184 -- launch in eda2.0 186 185 -- projection on ccm, changing the distance to 500 … … 188 187 DROP TABLE IF EXISTS geobs2010.roe_ccm_500_2; 189 188 CREATE TABLE geobs2010.roe_ccm_500_2 as ( 190 SELECT ref_id, r.cum_len_sea as dist_sea_ccm, r.distance_source as dist_source_ccm, r.strahler as strahler_ccm,gid ,CAST(distance(r.the_geom, s.ref_position_etrs89) as decimal(15,1)) as distance,s.ref_position_etrs89 189 SELECT ref_id, 190 r.cum_len_sea as dist_sea_ccm, 191 r.distance_source as dist_source_ccm, 192 r.strahler as strahler_ccm,gid , 193 CAST(distance(r.the_geom, s.ref_position_etrs89) as decimal(15,1)) as distance, 194 s.ref_position_etrs89, 195 CASE WHEN ref_hauteur_chute>0 then ref_hauteur_chute 196 WHEN ref_hauteur_chute=0 then ref_hauteur_chute 197 ELSE ref_hauteur_terrain 198 END AS height, 199 0 As score, 200 1 AS nbdams -- pour jointure ultérieure 191 201 FROM geobs2010.obstacle_referentiel As s 192 202 INNER JOIN ccm21.riversegments r ON ST_DWithin(r.the_geom, s.ref_position_etrs89,500) … … 239 249 b.distance as distproj_bdcar, 240 250 c.distance as distproj_ccm, 251 height, 252 score, 253 nbdams, 241 254 id_trhyd, 242 255 gid, … … 265 278 strahler_ccm, 266 279 distproj_bdcar, 280 height, 281 score, 282 nbdams, 267 283 min(distproj_ccm) as distproj_ccm, 268 284 the_geom … … 286 302 b.distance as distproj_bdcar, 287 303 c.distance as distproj_ccm, 304 height, 305 score, 306 nbdams, 288 307 id_trhyd, 289 308 gid, … … 295 314 --AND strahler_diff is TRUE 296 315 ) as sub1 297 group by ref_id, gid,id_trhyd,dist_source_bdcar,dist_source_ccm,dist_sea_bdcar,dist_sea_ccm,strahler_bdcar,strahler_ccm,distproj_bdcar, 298 the_geom 316 group by ref_id, gid,id_trhyd,dist_source_bdcar,dist_source_ccm,dist_sea_bdcar,dist_sea_ccm,strahler_bdcar,strahler_ccm,distproj_bdcar,distproj_ccm, 317 the_geom,height,score,nbdams 299 318 order by ref_id 300 319 ) ; … … 358 377 b.distance as distproj_bdcar, 359 378 c.distance as distproj_ccm, 379 height, 380 score, 381 nbdams, 360 382 id_trhyd, 361 383 gid, … … 383 405 distproj_bdcar, 384 406 min(distproj_ccm) as distproj_ccm, 407 height, 408 score, 409 nbdams, 385 410 the_geom, 386 411 1 as manual_insert … … 388 413 geobs2010.roe_ccm_500_full 389 414 where ref_id in (3652,23335,11879,23343,23351,23360,18820,23388,23365,18816,17954,18810,17958,18810,18810,18813,23368,3650,18809,3650,3650,23326,23332,3656) 390 group by ref_id, gid,id_trhyd,dist_source_bdcar,dist_source_ccm,dist_sea_bdcar,dist_sea_ccm,strahler_bdcar,strahler_ccm,distproj_bdcar, 391 the_geom,manual_insert );415 group by ref_id, gid,id_trhyd,dist_source_bdcar,dist_source_ccm,dist_sea_bdcar,dist_sea_ccm,strahler_bdcar,strahler_ccm,distproj_bdcar,distproj_ccm, 416 the_geom,manual_insert,height,score,nbdams); 392 417 393 418 }}}