On Thu, Sep 11, 2008 at 8:17 AM, tedd <[EMAIL PROTECTED]> wrote:

> Considering that my other profession is Geophysicist, I'm kind of up on
> those sort of things. The Earth is an oblate spheroid and the computation to
> include the curvature of the earth would be a bit more involved.

what do you think of the code i mentioned earlier?

$distance = number_format(ceil(69*rad2deg(acos(sin(deg2rad($ulat)) *
sin(deg2rad($vlat)) + cos(deg2rad($ulat)) * cos(deg2rad($vlat)) *
cos(deg2rad($ulong - $vlong))))));

where:

$ulat = latitude of user #1
$ulong = longitude of user #1

$vlat = latitude of user #2
$vlong = longitude of user #2

I took the very popular mysql query (at the time) that supposedly
works with a sphere and mapped it to php functions and it has appeared
to work very well. I have only tested with US zip codes, but the
concept should be the same as long as lat/long are centered properly.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to