# Thread: Calculate distance between two zip codes

1. Senior Member
Join Date
Dec 2007
Posts
3,908

## Calculate distance between two zip codes

You're going to need one hell of a table. Essentially you will need the latitude and longitude of every extant zip code. From there it's just a question of math. If such things already exist as canned PC subroutines, it may be worthwhile to wrap it in JAVA, or VB, and then use STRPCCMD, or RUNRMTCMD from your AS/400 program to obtain the results. Dave

2. D.Handy Guest

## Calculate distance between two zip codes

Stevie, First, you're going to need a database of current zip codes and their nominal midpoint latitude and longitude. Amazingly, this is not available free from any source (to my knowledge) although lots of places sell it. New databases are available every month. The US Census does have a free database available, but it is from their 1990 census. It has only around 29,470 records whereas there are around 43,000 current zip codes (or over 76,000 if you count zip codes with more than one city / county name assigned). The free 1990 database is at http://www.census.gov/geo/www/gazetteer/places.html if you are interested. Use Google to find sites that sell more recent databases; there are lots of providers with prices all over the map, so to speak. Once you have the database, it is just a matter of doing the math. One site with the forumlas is http://williams.best.vwh.net/avform.htm which has lots of aviation related formulas. Including great circle distance calculations. Doug

3. Guest.Visitor Guest

## Calculate distance between two zip codes

Thanks!

4. Guest.Visitor Guest

## Calculate distance between two zip codes

Hello: I'm working on a project where I need to find the distance between two zip codes. Has anyone done something along this line in RPG? Any help you give me will be appreciated. Kind Regards, Stevie Burden

5. Guest.Visitor Guest

## Calculate distance between two zip codes

Try ZIP/CITY from WorksRight software, www.worksright.com. Their site says: A distance calculation program is included that calculates the air-line distance between two ZIP Codes. The distance is calculated based on the average latitude/longitude of the post office serving the specified ZIP Code. It's \$395, or \$495 in 2003, with free monthly updates. We've used it just to keep our telephone area codes accurate.