[snip]
I'm entertaining how to determine what zip codes fall within a 50
mile radius of another zip code.
Anyone done this before?
Also, does anyone have any sources for zip codes and lat/long databases?
TIA for any help/suggestions.
[/snip]
Here is a code snip that I use to determine things within a certain
radius (5 miles) of a zip code;
/* calcs for distance */
function distance($lat1, $lon1, $lat2, $lon2) {
$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;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php