Kangry.com [insert cool graphic here]
home | Topics | Logout | Search | Contact | ?? Kangry ?? | Bandwitdh
Topics:
DVR
nvrec
Mplayer
Links
Misc
Commands
Humor

Name

Password

New user

uploaded files
(catalina22)-> latitude and longitude to distance formula submited by Russell Fri 12 Aug 05
Edited Mon 10 Sep 07
Web kangry.com
Formula for the distance between to points given in latitude and longitude
Except for some reason, this formula does not work for me..
I used this (a1,a2,b1,b2) =Latitude,longitude points a,b *IN RADIANS* $r=Radius of earth in desired units:
return sqrt(($a1-$b1)**2 + ($a2-$b2)**2)*$r;
This formula WILL BE WRONG for large distances, since it does not use a great circle route. (shortest route from NY to japan is via Alaska )

For my needs ( find the closest zip code to a given code) this formula is fine.

Free source of Zip code to latitude and longitude data

Avoid a pitfall that hit me if you use this data in perl. This database has leading zeros on negative values. Perl has a irritating habit of considering these to be Octal numbers ( not decimal numbers) This caused a lot of gibberish output. so do a $x=~s/-0/-/g; on the values before you treat them as numbers.


Add comment or question...:
Subject:
Submited by: NOT email address. Leave blank for anonymous    (Spam Policy)

Enter Text: (text must match image for posting)




This file (the script that presented the data, not the data itself) , last modified Tuesday 06th of March 2018 11:41:12 PM
your client: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
current time: Friday 26th of April 2024 02:00:58 AM