[postgis-users] Buffer vs. Expand

CYW cyw at dls.net
Wed May 31 10:34:04 PDT 2006


I need to find points that is within a certain range of a given point.
Initially I tried a query below:

SELECT AsText(geom) from point_table where geom && 
        Buffer(GeometryFromText('POINT(10000 20000 )', 2769),900));

Then I noticed that I should also be able to use another function Expand
instead of Buffer. 

Reading the manual, I can't tell which one is better here.

Additionally, is there a function that can give me the closest point or how
should I formulate a query for that? 

Any suggestions?

Thanks,
_cyw_



Manual excerpts below.
------------------------------------
Buffer(geometry, double, [integer])

    Returns a geometry that represents all points whose distance from this
Geometry is less than or equal to distance. Calculations are in the Spatial 
Reference System of this Geometry. The optional third parameter sets the
number of segment used to approximate a quarter circle (defaults to 8).

expand(geometry, float)

    This function returns a bounding box expanded in all directions from the
bounding box of the input geometry, by an amount specified in the second
argument. Very useful for distance() queries, to add an index filter to the
query.





More information about the postgis-users mailing list