[thelist] Calculating distnace between two zip codes.
April
april at farstrider.org
Tue Jan 30 18:16:32 CST 2001
That looks a lot like what I need... Umm, lol, where did you get the
latitudes, though?
----- Original Message -----
From: "Scott Dexter" <sgd at ti3.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, January 30, 2001 4:41 PM
Subject: RE: [thelist] Calculating distnace between two zip codes.
> > -----Original Message-----
> > From: April [mailto:april at farstrider.org]
> > Sent: Tuesday, January 30, 2001 4:33 PM
> > To: thelist at lists.evolt.org
> > Subject: [thelist] Calculating distnace between two zip codes.
> >
> >
> > I need to calculate the distance between two zip codes on a website.
>
> We (ti3) used the longitude and latitude of the center of each zip code
and
> calculated distance based on that. Here's the equation used (long and lat
> are in decimal, not degrees):
>
> double CGeoDistCtrl::getDistance(double Latitude1, double Longitude1,
double
> Latitude2, double Longitude2)
> {
> double dist, temp, radians;
>
> radians = .0174533; // conversion from degrees to radians for
> cosine function (pi/180)
> temp = 69.171; // number of miles in one degree longitude
>
> dist = temp * sqrt((((cos(((Latitude2 + Latitude1) / 2) * radians) *
> (Longitude2 - Longitude1)) *
> (cos(((Latitude2 + Latitude1) / 2) * radians) *
(Longitude2
> - Longitude1))) +
> ((Latitude2 - Latitude1) * (Latitude2 - Latitude1))));
>
> return dist;
> }
>
> Hope this helps some--
> sgd
> --
> work: http://www.ti3.com/
> non: http://thinksafely.org/
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>
>
>
More information about the thelist
mailing list