[postgis-users] Nearby result set ordered by proximity

Ilya Sterin sterini at gmail.com
Sat May 8 19:32:05 PDT 2010

Actually, I figured it out...

ORDER BY ST_Distance(location,
ST_GeomFromText('SRID=4326;POINT(-83.359752 42.521268999999997)'))

Unless there is a better way?


On Sat, May 8, 2010 at 8:40 PM, Ilya Sterin <sterini at gmail.com> wrote:
> I can't seem to figure out how I'd order a nearby result set by proximity.
> SELECT ST_AsGeoJSON(location), title, description
> FROM event
> WHERE ST_DWithin(location::geography,
> ST_GeogFromText('POINT(-82.914349 42.391138)'),4000);
> Above searches for everything in the vicinity of 40 km, but I want the
> result set in order of proximity to location.
> Thanks.
> Ilya

More information about the postgis-users mailing list