Changes between Version 18 and Version 19 of CookBook join ROE_CCM
- Timestamp:
- Mar 16, 2010 3:41:22 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TabularUnified CookBook join ROE_CCM
v18 v19 70 70 REM Cédric ======================= 71 71 CD 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.sql73 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 "72 C:\"Program Files"\PostgreSQL\8.4\bin\shp2pgsql -s 3035 -I DEPARTEMENT_3035 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 CASCADE" 74 C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -c "CREATE schema france " 75 75 C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -f departement.sql 76 76 REM Céline ======================= … … 81 81 C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5432 -f departement.sql 82 82 }}} 83 Join query we have 43937 lines 84 {{{ 85 SELECT count(ref_id) from geobs.obstacle_referentiel -- 43937 86 }}} 87 The following does not work and it makes sense, we should only have one geom of france 88 {{{ 89 SELECT 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 }}} 92 I first aggregate all departements and then join this glued layer with the dam layer, the distance is 2000 93 {{{ 94 SELECT count(ref_id) from geobs.obstacle_referentiel o 95 join (SELECT ST_Union(f.the_geom) as singlegeom 96 FROM france.departement As f) as sub 97 ON ST_DWithin(sub.singlegeom, o.ref_position_etrs89, 2000) --43909 98 }}} 99 100 83 101 84 102 == Build a view allowing to know the score of the different dams ==