« Return to Thread: Spatial query for the Nearest location given a lat and long?

Re: Spatial query for the Nearest location given a lat and long?

by bdbeames :: Rate this Message:

Reply to Author | View in Thread

Ok I'm completely lost.

I did more research and I ran across some information about the SRID, but none of this makes sense to me.  I've never looked at a spatial query before.

Lets say that I lave the lat and long points 41.7833, -111.855.  I now have a table called table_1 with id, name, lat, long, extra.  This is a very large data base 1-2 T-Bites.  Weather stations from across the US that are updated every hour.  I want to find the nearest station to the given lat and long point.

Could you be more specific of how to go about this.  

I also found mention of a Distance function, but no documentation of how it works.  Could I use this to find the top 1-5 nearest stations.  If so, could someone given me an example of how to write the query.

This is a postgres database NOT MYSQL

Thanks

 « Return to Thread: Spatial query for the Nearest location given a lat and long?