[postgis-users] Nearby result set ordered by proximity

Ilya Sterin sterini at gmail.com
Sat May 8 17:40:38 PDT 2010

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.



More information about the postgis-users mailing list