The link you post is good, but there is a simpler way (usually).
Typically this kind of request is, as the OP mentioned, for "... near
me" type operations. In which case they're zip-code to zip-code based.

The long/lat of a zip-code is usually based on the center of the
rhomboid the zip-code covers. As such, the distance is only accurate if
you happen to be at the exact center of the from-zip-rhomboid and you
happen to be going to the exact center of the to-zip-rhomboid, and even
then, it's an as-the-crow-flies distance, not a driving distance. All
that is to say, the calculation is an approximation anyway. Therefore,
if you're into approximations...

Distance = sqrt(x * x + y * y)

where x = 69.1 * (lat2 - lat1)
and y = 53.0 * (lon2 - lon1)

This can be off by 10%, but if you're looking for stuff in a 50 mile
radius, what's 5 miles? Especially since the center of the zip is
probably more than 5 miles from where I am anyway, and I need to add 10
miles for the trip since the roads don't go directly.

-Walden

--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.