[postgis-users] query explanation

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


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

Frances Collier

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Brent
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
> 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
generate the polygon you require, depending on the data projection and

One approach which could work is along the lines of:

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

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


  Brent Wood 
postgis-users mailing list
postgis-users at postgis.refractions.net

More information about the postgis-users mailing list