[postgis] Spatial Query

Paul Ramsey pramsey at refractions.net
Thu Jun 14 09:34:28 PDT 2001

Doug Nebert wrote:
> I would like to know the syntax or references to such examples
> that would facilitate a query of a point dataset with a circle (point
> and radius) area of interest. Basically I want to quickly clip out
> all points falling in a circle and then use the result to sum one of
> the columns for the selected region.
> Where, if anywhere, might there be a reference set of example
> spatial operators (encloses, overlaps, touches, etc) and primitives
> for PostgreSQL?  Does it truly follow the Simple Features SQL
> specification from OpenGIS?

The postgreSQL users manual gives all the spatial operators. The only
one which is truly germain to PostGIS right now is '&&' which is
'overlaps', and it is only processed in the naive sense of
'boundingbox(a) overlaps boundingbox(b)'. 

With respect to the simple features spec, PostGIS tries to follow the
input/output API: the text representation is the OGIS one (and Dave just
finished off well-known binary representation! have I mentioned that
Dave rocks?). 

The full SFSpec has scads of really hard operators. It's possible we'll
do them in the future, but it is not a top-of-the-foodchain requirement

To solve your specific problem with PostGIS quickly on a large dataset
you'll have to note firstly that we don't have a 'circle' object. We
have the SF objects, so if you want a circle, you'll have to construct
one vertex-by-vertex (or construct a similar sized box). Secondly, you
can query your (presumably large) table of points against your query
feature with the && operator. Then, sadly, you'll have to write the
'within distance X of my center point' routine on the client side to
scroll through the small set of query results and discard the ones you
don't want.

At the moment, we're just trying to make storage & retrieval work as
well as possible. GIS-style functionality like the buffer query,
'within-X-yards-of', 'clipped-to-X', etc, is farther down the priority
chain at the moment.

     | Paul Ramsey
     | Refractions Research
     | Email: pramsey at refractions.net
     | Phone: (250) 885-0632

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the postgis-users mailing list