http://www.techraza.com/other/search-around-a-particular-latitude-and-longitude-by-a-given-radius/
Copied from above URL
------------
This post is related to search around a particular latitude and longitude for a given radius in Km or Miles.
- One degree of latitude is equal to about 69 or 70 miles or 111 Km.
- Suppose you have to search in a circle of 4 miles ,the center of the the circle is lat,long you have.
- Since 70 miles is equal to 1 degree lat then the latitude radius will be “4/70=0.057″ .
- now suppose the center point lat, long is:latitude=26.262011,longitude=81.546562 then the range will be in which you have to search will be: minLat=26.262011- 0.057 maxLat=26.262011+ 0.057 minLong=81.546562 – 0.057 maxLong=81.546562 + 0.057
- Now you can run a sql query to database with between statement like:- where latitude between “this” and “this” and longitude between “this” and “this” .
- It will give you all the location’s lat ,long that are in that 4 miles circle around given lat long center point.
No comments:
Post a Comment