Re: Zip Code Locator?
| From: | Justin Farnsworth | Date: | Tue, 24 Jul 2001 21:03:53 +0000 |
| Subject: | Re: Zip Code Locator? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59437@lists.php.net to get a copy of this message | ||
Kurth Bemis wrote:
>
> At 04:42 PM 7/24/2001, Benjamin Bleything wrote:
>
> i'm pretty sure that the extra numbers are coord of that town. you know
> the long and lat.
[== snip, snip ==]
FWIW, here is the formula needed, here just a snippet getting the
distance between two ZIP's, and, yes, Virginia, you have to
have the latitude and longitude in radians:
#== construct the computed distance field (artificial field) ==
$dist = "(ACOS(SIN($this->LAST_LAT) * ";
$dist .= "SIN(LatRad) + ";
$dist .= "COS($this->LAST_LAT) * ";
$dist .= "COS(LatRad) * ";
$dist .= "COS(LongRad -$this->LAST_LONG)) *";
$dist .= "3958.88012572)";
For this snippet, consider LAST_LAT and LAST_LONG the
"first point" in this spherical geometry solution, nicely all
done by MySQL. But you can do the formula in PHP, if you
wish.
------------------------------------------
> > >On Mon, 23 Jul 2001, Vincent P. Cocciolone wrote:
> > >
> > >> Hi,
> > >>
> > >> Does anyone know where can I find documentation or example scripts for
> > >
> > >> a zip code locator. I'm looking for something that will list other zip
> > >
> > >> codes within a number of miles radius of the zip specified.
> > >>
> > >> Thanks!
> > >>
> > >> Vince
--
Justin Farnsworth
Eye Integrated Communications
321 South Evans - Suite 203
Greenville, NC 27858 | Tel: (252) 353-0722