Quote:
Originally Posted by rowan
Never seen geo dating ads do surrounding areas, which seems like something obvious... guess someone has to think of it first! :D How do you determine the surrounding cities, is that part of the maxmind db too?
(I don't recognise any of the names in your sample because my geo IP loc pretty much always shows me in another state)
|
Surrounding areas are calculated from latitude/longitude parameters of the visitor IP - complicated maths cos the world isn't flat ;)
$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
$unit = strtoupper($unit);
Surrounding areas can be turned off in that add image:
Nearby ON:

and with Nearby OFF:
