RE: zip codes and lat/longs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux