[Mapserver-users] PostGIS Spatial Query - Completely Within

David Blasby dblasby at refractions.net
Fri May 30 12:14:23 EDT 2003


Benjamin Wragg wrote:

> What I need to do now is alter this query slightly and only find 
> polygons that are completely within the country selected.

You can do this, but you have to have the GEOS (JTS for C++) extension. 
  cf. geos.refractions.net  and postgis.refractions.net  See recent 
messages in the mailing list archive.

The first [experimental] version of GEOS for PostGIS has been released, 
but not for general consumption.

Your query would be something like:

SELECT * FROM <table> WHERE contains(g1,g2)

See http://www.opengis.org/techno/specs/99-049.pdf for the OGC 
definition of 'contains' and other spatial operators.

dave




More information about the mapserver-users mailing list