$southwest_lat = $_GET['swlat'];
$southwest_lng = $_GET['swlng'];
$northeast_lat = $_GET['nelat'];
$northeast_lng = $_GET['nelng'];
Your help is much appreciated.
Kind regards,
Olivia
| Aaron Singline (about
me) Co-Founder / Support |
|
| Turboweb Limited Office: +64 3 474 5953 Cell: 022 657 8302 Web: www.turboweb.co.nz Twitter: twitter.com/turboweb Facebook: facebook.com/turboweb |
Turboweb Limited 23 Vogel St Dunedin 9016 New Zealand |
Need help? Please email sup...@turboweb.co.nz
--
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to nzp...@googlegroups.com
To unsubscribe, send email to
nzphpug+u...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "NZ PHP Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nzphpug+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
$result = distance($southwest_lat, $southwest_lng, $northeast_lat, $northeast_lng, "K");
if($result > 20) { echo "over 20!";} else {
echo "over 20!";
}
function distance($lat1, $lon1, $lat2, $lon2, $unit) {
$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);
if ($unit == "K") {
return ($miles * 1.609344);
} else if ($unit == "N") {
return ($miles * 0.8684);
} else {
return $miles;
}
}--
--
You received this message because you are subscribed to a topic in the Google Groups "NZ PHP Users Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nzphpug/CxLD69RZC-Y/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to nzphpug+u...@googlegroups.com.