Jump to content

# Distance Between Zip Codes

## Recommended Posts

So,

I was making a program to automatically show the distance between a client's START zip code, and that of the zip codes of our events. Since i made this script FIRST, to ensure that the math was working with the formulas i found online, I decided to make it a bit easier to read, and follow.

Basically, it uses the (somewhat hacked version, hehe) Haversine formula to calculate the distance across a sphere from the given zip code's latitude and longitude positions. The data is provided by the US Census bureau, and the file is required to run the program

NOTE: As it's math, and not pulling from a secondary site, no, it's not 100% accurate; but, hey, it gets you the information rather close to the actual distance.

Instructions

Download ZIP Code DATA: http://www.census.gov/tiger/tms/gazetteer/zcta5.zip

Download the following script, and put BOTH files in the SAME DIRECTORY and run

What happens when script runs normally.

What happens when Zip1 or Zip2 is bad.

Enjoy!

dst.au3

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×ï§†§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×ï§† ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë ë§§ëñ§ë øƒ !ïƒë.

#### Share this post

##### Share on other sites

Very nice! Thanks for sharing..

#### Share this post

##### Share on other sites

Excellent Program, and an interesting way of calculating distance. When I first read the topic I assumed you would just pull information from MapQuest or Google Maps; Using Latitude/Longitude is an original way of doing it.

"The true measure of a man is how he treats someone who can do him absolutely no good."

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

×

• Wiki

• Back

• Git