Re: [postgis-users] Nearby result set ordered by proximity

2010-05-08 Thread Ilya Sterin
Actually, I figured it out...

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

Unless there is a better way?

Ilya


On Sat, May 8, 2010 at 8:40 PM, Ilya Sterin  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
>
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Nearby result set ordered by proximity

2010-05-08 Thread Ilya Sterin
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
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users