[postgis-users] Distances from geometries other than points

Julian Scarfe julian at avbrief.com
Sat Apr 9 10:49:31 PDT 2005


I have a table of worldwide objects with a WGS84 latitude-longitude location 
as a POINT with SRID=4326.

To find objects within specified earth-surface distances of a POINT seems 
straightforward using e.g.:

distance_spheroid(
    object.location,
    PointFromText('POINT (0.5 52.5)', 4326),
    'SPHEROID["WGS_1984", 3444.0, 298.257223563]'
 )

to calculate, for example, the distance in nautical miles.

But I'd like to be able to find all those objects within specified 
earth-surface distances (different for each object) of other geometries, for 
example a line or rectangle.

How can I do that, please? distance_spheroid(geometry, geometry) seems to 
support only points and distance(geometry, geometry) returns a "flat-earth" 
distance.

Julian Scarfe






More information about the postgis-users mailing list