Nearest zip code of a zip code?

22,665

Solution 1

what country? Maybe you want to checkout Geonames: http://www.geonames.org/

Especially: http://www.geonames.org/export/web-services.html#findNearbyPostalCodes

Solution 2

This answer is in response to the recent bounty requesting a location of US Zip Codes.

The United States Census Bureau has a list of zip codes (with latitude and longitude) on their web site.

The zip code tabulation areas is a CSV that contains (as described in the description of the file format), among other fields:

Column 1    GEOID   Five digit ZIP Code Tabulation Area Census Code
...
Column 6    INTPTLAT    Latitude (decimal degrees) First character is blank or "-" denoting North or South latitude respectively
Column 7    INTPTLONG   Longitude (decimal degrees) First character is blank or "-" denoting East or West longitude respectively

I'd cross reference the above, with data from the Census Bureau's county business patterns CSV to get city, state and county names. This file format is described to contain (among other fields) (description is in the file you select to download):

ZIP             C       ZIP Code
NAME            C       ZIP Code Name
...
CITY            C       ZIP City Name
STABBR          C       ZIP State Abbreviation
CTY_NAME        C       ZIP County Name

Solution 3

Here is a free web service to do exactly what you need: http://www.zipwise.com/webservices/

Solution 4

I tested geonames and did not find it good enough. Test areas near your zip code and you will not find all the zipcodew. These have good results but have not found any API yet http://www.searchbug.com/tools/zip-radius.aspx

Solution 5

For the nearest ZIP Code, there are two approaches: find contiguous (adjoining) ZIP Codes and/or find the nearest ZIPs based on the distance from the center of one ZIP Code to the center of another, based on latitude and longitude.

To choose the contiguous ZIP approach, you will need ZIP Code Boundaries data. Alignstar makes one that we're very pleased with (we resell it), but ESRI and a couple of other companies have good products as well. My company, GreatData.com, developed a contiguous counties product and could develop a contiguous ZIP Codes product, but so far, nobody has been asking for it. This could be a data file or an API.

To find the nearest ZIP Codes based on centroids (latitude / longitude center points of the ZIP Code), you will need a ZIP Code Database with latitude / longitude data (we provide one, or go here for links to some free resources: //http://uszipcodes.com/free-zip-code-lookup.htm. If you just want an API and not the hassle of doing it yourself, let us know. We've started to develop similar APIs and will develop based on the demand.

One caveat of doing this by the centroids: we've seen in the past where if you have a large (or long), adjoining ZIP, the center of that ZIP could be farther away than another small ZIP Code, so your list of the 5 nearest could miss an adjoining ZIP.

Share:
22,665
davitz38
Author by

davitz38

Updated on July 09, 2022

Comments

  • davitz38
    davitz38 almost 2 years

    I need to find the 5 nearest zip code of a zip code. For example, I have 33304, and I need to find the nearest ones, like 33309, 33308 ...

    Is there a database or a web service somewhere that would help me with that?

    I think I'm gonna have to build my own database in order to do that? I know how to do it, but in case it has already been done ...