Changes between Version 18 and Version 19 of CookBook join ROE_CCM


Ignore:
Timestamp:
Mar 16, 2010 3:41:22 PM (15 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TabularUnified CookBook join ROE_CCM

    v18 v19  
    7070REM Cédric ======================= 
    7171CD C:\Documents and Settings\cedric\Mes documents\Migrateur\eda\couches_SIG\france 
    72 C:\"Program Files"\PostgreSQL\8.4\bin\shp2pgsql -s 3035 -I DEPARTEMENT france.departement> departement.sql 
    73 C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -c "DROP schema if exists france" 
    74 C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -c "CREATE schema france" 
     72C:\"Program Files"\PostgreSQL\8.4\bin\shp2pgsql -s 3035 -I DEPARTEMENT_3035 france.departement> departement.sql 
     73C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -c "DROP schema if exists france CASCADE" 
     74C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -c "CREATE schema france " 
    7575C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -f departement.sql 
    7676REM Céline ======================= 
     
    8181C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5432 -f departement.sql 
    8282}}} 
     83Join query we have 43937 lines 
     84{{{ 
     85SELECT count(ref_id) from geobs.obstacle_referentiel -- 43937 
     86}}} 
     87The following does not work and it makes sense, we should only have one geom of france 
     88{{{ 
     89SELECT  count(ref_id) from geobs.obstacle_referentiel o 
     90 join france.departement f ON ST_DWithin(f.the_geom, o.ref_position_etrs89, 2000); --49468 
     91}}} 
     92I first aggregate all departements and then join this glued layer with the dam layer, the distance is 2000 
     93{{{ 
     94SELECT  count(ref_id) from geobs.obstacle_referentiel o 
     95join (SELECT ST_Union(f.the_geom) as singlegeom 
     96         FROM france.departement  As f) as sub 
     97ON ST_DWithin(sub.singlegeom, o.ref_position_etrs89, 2000) --43909 
     98}}} 
     99 
     100 
    83101 
    84102== Build a view allowing to know the score of the different dams ==