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

bdbeames bdbeames at cc.usu.edu
Sat Aug 11 12:53:56 PDT 2007


I'm completely new to this so I need some help writing a query.

What I have is two tables with weather station information: id, name,
latitude, longitude, extra.

I am using google map where a user can click on a station from one of the
tables, I obtain the $latitude and $longitude points of that location.  I
now want to use these to find the nearest weather station in my other table
based on the $latitude and $longitude point.

All that I need back from the query is the id and name of the nearest
station.  Could someone help me write a simple query to do this. 

My development environment is Linux/Apache/Postgres/php.

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




More information about the postgis-users mailing list