Version 11 (modified by cedric, 15 years ago) (diff) |
---|
this is ticket: #49
We need to only select a geographical region from the ccm plus all downstream segments within this region.
Below we use the ST_Contains function
/*boolean ST_Contains(geometry geomA, geometry geomB); Description Geometry A contains Geometry B */ -- first trial.. /* SELECT count (*) from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM france.departement As f) as sub ON ST_Contains(sub.singlegeom,r.the_geom); */ -- we try to get the vector of seaoutlets that are within the geographical area
-- a table containing three columns
drop table if exists france.wso; CREATE TABLE france.wso ( id serial PRIMARY KEY, wso_id integer, area varchar(12) )insert into france.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT ST_Union(f.the_geom) as singlegeom FROM france.departement As f) as sub ON ST_Contains(sub.singlegeom,r.the_geom); --170703 lines UPDATE france.wso set area='France' where area IS NULL
select * from ccm21.riversegments where wso_id in (select wso_id from france.wso where area='France')--170703 lines
CREATE INDEX france_wso_id ON france.wso (wso_id);
-- pour des essais sélection de la Bretagne insert into france.wso(wso_id) select distinct on (wso_id) wso_id from ccm21.riversegments r join (SELECT the_geom FROM france.region where code_reg='53') as sub ON ST_Contains(sub.the_geom,r.the_geom); --170703 lines UPDATE france.wso set area='Bretagne' where area IS NULL