[postgis-users] query explanation

Frances Collier fcollier at preparedresponse.com
Mon Apr 24 15:35:55 PDT 2006

```Brent,

I am still working on it, but I wanted to be sure to say thank you for
taking the time to help.

Sincerely,
Frances Collier

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Brent
Wood
Sent: Saturday, April 22, 2006 12:17 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] query explanation

--- Frances Collier <fcollier at preparedresponse.com> wrote:

> Hello,
>
> I am trying to figure out how to write a query that will give me a
specific
> area that is the union of a buffer and an intersect result. I haven't been
> able to find anything to give me a hint. Is there anything written that
> gives examples of queries in postgis other than the manual?

Nothing specific that I'm aware of, but area calculation is complex. PostGIS
has the function area2d in addition to the OGC area function, both of which
AFAIK, will return the cartesian area in map units. I'm not sure of the
difference between these, but I'd guess there was a good reason for
implementing the area2d one :-)

To derive a reasonably accurate area, the data needs to be in a suitable
(equal-area) projection. The buffer function may also need to be reprojected
to
generate the polygon you require, depending on the data projection and
distance
units.

One approach which could work is along the lines of:

select area2d(buffer(transform(<geometry>, <SRID>), <buffer-dist>))
+ area2d(transform(intersection(<geometry>, <geometry>))) as
geom_area
from <table> .....;

It may get more complex, with more transforms (depending on your data), as
you
may require reprojections within your buffer & intersection functions, and
your
data may be from different tables...

HTH,

Brent Wood
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

```