<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>overlap query</title></head><body>
<div>All:</div>
<div><br></div>
<div>I am trying to determine the amount (in hectares) of 1 or more
protected areas (parks) that overlap a watershed.</div>
<div><br></div>
<div>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.</div>
<div><br></div>
<div>Though this doesn't calculate the hectares yet, so far its
returning nil.</div>
<div><br></div>
<blockquote>SELECT shape_pa.name, shape_pa.the_geom from
shape_watershed, shape_pa</blockquote>
<blockquote>WHERE (shape_watershed.the_geom &&
shape_pa.the_geom) AND</blockquote>
<blockquote
>area2d(intersection(geometryn(shape_watershed.the_geom,0),geometryn(<span
></span>shape_pa.the_geom,0))) > 0 AND shape_watershed.name =
'Belize River'</blockquote>
<div><br></div>
<div>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:</div>
<div><br></div>
<blockquote>SELECT sum(area(shape_pa.the_geom))/10000 as hectares
FROM</blockquote>
<blockquote>(</blockquote>
<blockquote>above query</blockquote>
<blockquote>);</blockquote>
<div><br></div>
<div>Any thoughts on why this isn't working?</div>
<div><br></div>
<div>Cheers,</div>
<div><br></div>
<div>Jerod Clabaugh</div>
<div>Belize Biodiversity Mapping Service</div>
<div>http://www.iwlearn.net/belize</div>
</body>
</html>