[postgis-users] Nearest Operator

Roy Irwan mroy at centrin.net.id
Sun May 11 23:33:55 PDT 2003


----- Original Message -----
From: "Michael O'Sullivan" <mos at i...>
Sent: Saturday, May 10, 2003 10:08 AM

>
> Try looking at the FAQ (http://postgis.refractions.net/docs/c191.html)
>
> 8. What is the best way to find all objects within a radius of another
> object?
>
> I use something like this to find the nearest point in the database to a
> given point. I do a bounding box query as in the FAQ and then select the
> minimum distance (calculated using length_spheroid) of the subset of
> points to get the closest point to a given point. Depending on what your
> data set is (e.g. a projected coordinate system or lat long) you may
> want to use the distance function rather than length_spheriod.
> My geometries are all Lat/Long based POINT objects (in this case).

Is there any simple way to get also the distance for each row of the result?

> hope this helps,
>
> Michael

Thx,
Roy




More information about the postgis-users mailing list