[postgis-users] overlap query

Jerod Clabaugh jclabaugh at mac.com
Tue Aug 31 14:52:17 PDT 2004


All:

I am trying to determine the amount (in hectares) of 1 or more 
protected areas (parks) that overlap a watershed.

basically, what amount in hectares of a watershed that is protected 
(falls within protected areas).  Both the Protected Areas layer 
(shape_pa) and Watershed Layer (shape_watershed) are polygon layers 
(multipolygon) and have OID and GIST indexes.  They also have the 
same SRID.

Though this doesn't calculate the hectares yet, so far its returning nil.

SELECT  shape_pa.name, shape_pa.the_geom from shape_watershed, shape_pa
WHERE (shape_watershed.the_geom && shape_pa.the_geom) AND
area2d(intersection(geometryn(shape_watershed.the_geom,0),geometryn(shape_pa.the_geom,0))) > 
0 AND shape_watershed.name = 'Belize River'

I was hoping this query would return the name of the protected areas 
that overlap the watershed and their the_geom columns. Once I got 
that far then I'd use it as a subquery to then calculate the hectares 
as:

SELECT sum(area(shape_pa.the_geom))/10000 as hectares FROM
(
above query
);

Any thoughts on why this isn't working?

Cheers,

Jerod Clabaugh
Belize Biodiversity Mapping Service
http://www.iwlearn.net/belize
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20040831/b9f3e52d/attachment.html>


More information about the postgis-users mailing list