[postgis-users] Distances from geometries other than points

Julian Scarfe julian at avbrief.com
Fri Apr 15 00:52:16 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.

OK, so if no one will bite on that one, let me ask a slightly different 
question.

Can I extend PostGIS to incorporate functions that allow me to find, e.g. 
shortest distances on a sphere between a point and a line (great circle), 
and if so, where should I look to find out how to do that?  [I'm not asking 
for algorithms, which I have, I'm wondering how to add functions that accept 
geometries as parameters, and for examples.]

Thanks

Julian Scarfe 





More information about the postgis-users mailing list