i am trying to create a web service for our mobile developers.
I have database of coordinates of locations. How do I return the result of nearby coordinates given a coordinate? Lets say within a radius of 100 miles.
Any idea?
The distance in meters between to points with coordinates (lat1|lng1) and (lat2|lng2) can be calculated using
arccos(sin(lat1)sin(lat2)+cos(lat1)cos(lat2)cos(lng1-lng2))
-----------------------------------------------------------------------
sqrt((cos(0.5(lat1+lat2))/6378137)^2 + (sin(0.5(lat1+lat2))/6356752)^2)
The numerator calculates the respective distance on a sphere with radius 1. The denominator adjusts for the radii of the earth across the minor and major axis.