# Numeric distance vs geographic distance in zip codes

If two zip codes numbers are close, are the regions they represent close? How much can you tell about how far apart two regions are by comparing their zip codes? (Zip codes are US postal codes. The name is an acronym for “Zone Improvement Plan” and was introduced in 1963.)

To investigate this, I looked at some data on zip codes that I purchased last year. I selected the zip codes with latitude and longitude coordinates [1] and computed the distance between consecutive zip codes, consecutive in the sense of being the next item in the list of assigned zip codes, not necessarily consecutive integers.

The closest consecutive zip codes are 10171 and 10172 in Manhattan. These zip codes are neighboring blocks and so you could say their distance is zero. The distance using the latitude and longitude values in my data is 0.05 miles.

The furthest consecutive zip codes are 96863 in Honolulu, Hawaii and 97001 in Antelope, Oregon. These locations are 2,658 miles apart.

The mean distance between consecutive zip codes is 34.4 miles and the median distance is 24.9 miles. So consecutive zip codes are often fairly close geographically, but not always.

Next I went back and divided the geographic distance between consecutive pair of zip codes by the numerical difference between the codes, taking a sort of “derivative”.

By this measure, the furthest consecutive zip codes are 99685 and 99686, which happen to also be consecutive integers. The both are in Alaska, the form former in Unalaska in the Aleutian Islands and the latter in Valdez on the mainland.

The mean and median distance in terms of miles per integer difference is 26.4 and the median is 16.9.

The previous post shows how you could use Hilbert curves to assign zip codes to a grid so that consecutive codes always correspond to neighboring squares.

## Related posts

[1] A lot of zip codes don’t have coordinates because they serve an administrative function more than strictly representing a geographic region.

## 2 thoughts on “Numeric distance vs geographic distance in zip codes”

1. Nathan

I appreciate your thoroughness. Most questions which occurred to me while reading were answered in the subsequent paragraphs. Very interesting post!

2. Fun fact: in most states zip codes were assigned with some effort to keep the “geographic derivative” small, but in Rhode Island they were assigned alphabetically by the name of the post office.