Postal / Zip Code Regional Algorithms?

Started by
6 comments, last by gmcbay 19 years, 12 months ago
I''ve googled (and found something about the NAC which was pretty neat) and googled, but I can''t seem to come up with anything. You know how dating services can take your zip or postal code, and find anyone with X km / m of your location? Is there any published webpage on the algorithms to determine this? I can''t seem to find anything. Any help is welcome here, thanks.
Advertisement
Unfortunatly, Zipcodes are not distributed evenly, and not always in an orderly manner.
The first number increases heading west. 22554 is in Virginia, and 90210 is in California. The next two digits usually corrospond to a district. Some districts have more numbers, some share them. #25## is in the Richmond district.
The final two digits are an individual office. Some offices deliver to multiple zipcodes, and most sets of Post Office Boxes have their own zipcode.
You can make some assumptions. If the first three numbers are the same, chances are they are pretty close. The numbers closer to the right are more chaotic - that is, where they are placed on a map is less predictable. The USPS leaves numbers open for growth, but sometimes they run out and have to leap thirty or fourty numbers for a new zipcode.

Yes, I am a postal worker. :D
God, you''re a nerd!

How about crossing the list of zip (optionally +4) codes with a map? Shove the data in a table and look it up at runtime?

How about the USPS Address Information Systems (AIS) Products? Or the USPS Web APIs?
Sure, those work. But he asked for an algorithm that took the numbers.
I never thought a moderator could be that immature.

Intro Engine
I used to work for a web mapping service (Vicinity.com), so I have a pretty good idea about this kind of thing, and nobodynews is right. There isn''t an algorithm, really, it is all database driven.

When comparing distances between two zipcodes, what they do is have a database that contains all the zipcodes mapped to the latitude and longitude of the center of the zipcode (they buy these databases from map data companies, like Etak).

The just look up the zip, take the lat/lons of both and do a very simple distance formula between two points, the same one you probably learned in basic 8th grade or high school math.

( See: http://www.purplemath.com/modules/distform.htm )
I was afraid it would involve purchasing the information =P

Ah well. Thanks for your help guys.
If you just want the zip centroids and not full address maps, you can get them pretty cheaply. Check out these folks:

http://www.zipcodedownload.com/

This topic is closed to new replies.

Advertisement