6 | | select id_drain, id_bdcarth from rht.rhtvs2 r inner join bd_carthage2011.hydrographie_surfacique bd on st_within(r.the_geom, |
7 | | st_buffer(bd.the_geom,100)) order by id_bdcarth; |
| 9 | alter table bd_carthage2011.hydrographie_surfacique add column surface numeric; |
| 10 | update bd_carthage2011.hydrographie_surfacique set surface=sub.surface from (select id_bdcarth, area2d(the_geom) as surface from bd_carthage2011.hydrographie_surfacique) as sub; |
| 11 | |
| 12 | COMMENT ON COLUMN bd_carthage2011.hydrographie_surfacique.surface IS "Surface en m² calculée avec requête spatiale area2d" |
| 13 | |
| 14 | select sum(area2d(the_geom)), type from bd_carthage2011.hydrographie_surfacique group by type; |
| 16 | |
| 17 | Création d'un buffer 100m pour récupérer les tronçons inclus dans la couche surfacique bdcarthage |
| 18 | {{{ |
| 19 | #!sql |
| 20 | drop table if exists bd_carthage2011.hydrographie_surfacique_100; |
| 21 | create table bd_carthage2011.hydrographie_surfacique_100 as |
| 22 | select id_bdcarth, nature, type, toponyme, st_buffer(the_geom,100) as the_geom from bd_carthage2011.hydrographie_surfacique; |
| 23 | CREATE INDEX indexhydro_100 ON bd_carthage2011.hydrographie_surfacique_100 |
| 24 | USING GIST ( the_geom GIST_GEOMETRY_OPS ); |
| 25 | }}} |
| 26 | |
| 27 | Jointure couche surfacique bdcarthage - RHT |
| 28 | {{{ |
| 29 | #!sql |
| 30 | select id_drain, id_bdcarth from rht.rhtvs2 r inner join bd_carthage2011.hydrographie_surfacique_100 bd on st_contains(bd.the_geom, |
| 31 | r.the_geom) order by id_bdcarth; |
| 32 | |
| 33 | select id_drain, id_bdcarth from rht.rhtvs2 r inner join bd_carthage2011.hydrographie_surfacique_100 bd on st_within(r.the_geom, |
| 34 | bd.the_geom) order by id_bdcarth; |
| 35 | }}} |