[postgis-users] Query for shapes completely within a circle
Jordan, Thomas
tjorda01 at harris.com
Sat Feb 6 09:12:58 PST 2010
Using ST_DWithin(geom, geomPt, radius) returns all geom that
'intersects' any part of the circle's area (acts like ST_Intersects).
What I would like, however, is only those geom 'completely within the
circle'.
For instance, if the point is Orlando, FL and the radius is 2 miles, the
ST_Dwithin would return a shapes like the state Florida and the whole
US; where I only want the buildings in Orlando.
This is the closest approximation I have so far:
SELECT id, geom
FROM geospatial
WHERE ST_WITHIN(geom, ST_Expand(geometryFromText(geomPt, 4326), radius)
)
This is much better, but it still returns some geom that are outside of
the circle; specifically all geom completely within the superscribing
box returned by ST_EXPAND.
Thanks for your help
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100206/75bb77cf/attachment.html>
More information about the postgis-users
mailing list