22

My requirement is to get the Latitude and Longitude value for a particular zip code. Is there any API that I can use to get these information. As I am working in a company so the requirement is coming for our team is to find the latitude and longitude value for a particular zip code. So we were thinking to build a new service for this. So what reliable data source we can use to get these information back if we are passing zip code to our service. Or what can be the best approach that I can propose to my PM about this requirement. Any pointers will be appreciated.

Just to add, that data source should have all the zip codes, latitudes and longitude in a world. Not that much accurate but mostly it should cover around more than 95% coverage.

Update

I did some research and I found that I can use Maxmind data for this but Maxmind data doesn't cover all the zip code list.

6 Answers 6

34

You can download zip code and corresponding lat and long values for different countries from here: (this is open source data and free of charge)

http://download.geonames.org/export/dump/

You can then import the data into your database and query it.

Hope this helps.

3
  • 12
    The given link is for general data; postal code data is at download.geonames.org/export/zip
    – Austin
    Dec 24, 2014 at 5:55
  • @Austin Thanks, your link should be the answer
    – Chenna V
    Nov 29, 2015 at 18:08
  • Checkout the comments at the end of the website http://download.geonames.org/export/zip/, some countries are not fully covered due to copyright constraints. Feb 23, 2018 at 15:56
13

Please have a look at Google Geocoding API and at Yahoo! PlaceFinder.

Both of them have Geocoding features, which is exactly what you want (obtaining map (latitude, longitude) coordinates from partial or full addresses).

2
  • I haven't read the full link. But at a glance it takes parameter as full US address and then give back the lat and long. But in my case I need to pass zip code to the service and get lat and long values back.
    – arsenal
    Jul 6, 2012 at 0:58
  • @rjchar The Google API will accept a partial address. I know because the site I work for does this. The vaguest we give it is a suburb or town name (plus country).
    – staticsan
    Jul 6, 2012 at 1:03
3

If you need commercial grade, consider this: http://greatdata.com. If you do not need this level of quality, here is a list of some other sources w/ pros & cons (it's worth reading just to understand the differences between zip, zcta, usps, census, etc. versions of the data).

ps - you said 'entire world' but your other responses and the term 'zip code' itself seem to imply primarily US. The above link goes beyond US but not the entire world.

Regarding the Google API mentioned already, please be aware of Google's TOS. Specifically: "Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited."

I am an employee for greatdata.

1

GeoNames has a nice straightforward API with pretty good coverage. (Docs)

example usage: http://api.geonames.org/postalCodeSearch?postalcode=98122&maxRows=10&username=demo

0

What about this: http://www.boutell.com/zipcodes/ ?

2
  • I don't want any static thing. By looking at that link, I don't think so it is getting updated.
    – arsenal
    Jul 6, 2012 at 0:56
  • this is an older database, lacks many of the new zip codes. doesn't get updated.
    – Anatoly G
    Dec 3, 2014 at 21:34
0

I have a situation where there are 12 warehouses nationwide and I needed to find the nearest one that has inventory for an item. My simple solution was to take the absolute value of the difference between the target zip code and the 12 warehouses. And then, simply ordering them by the lowest to highest difference in zip code numbers and querying the inventory in that order. It seems that just getting the ABS(zip1 - zip2), yields the closet distance between two zipcodes.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.