[postgis-users] Spatial query for the Nearest location given a lat and long?

bdbeames bdbeames at cc.usu.edu
Mon Aug 13 12:02:37 PDT 2007


ok 

I'm starting to get somewhere with this thing, but it is still returning
incorrect values.  I got this working before I read the last two post.  I'll
try your ideas, and see if they help.  

This is what I have so far, but it is returning the wrong values.  I'm
assuming because the query does not take into account that earth is a
sphere.  

SELECT id,name 
FROM coop.stations 
ORDER BY Distance(GeomFromText('POINT(-111.855 47.7833)') , 
GeomFromText('POINT('||coop.stations.longitude||'
'||coop.stations.latitude||')')) asc limit 5;

Feel free to point out what I'm doing wrong.

Thanks
-- 
View this message in context: http://www.nabble.com/Spatial-query-for-the-Nearest-location-given-a-lat-and-long--tf4253824.html#a12132002
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list