Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert postal code to city name, is there an API available? [closed]

How to convert post code to city name, is there an API available?

like image 932
Ling Avatar asked May 17 '10 03:05

Ling


People also ask

What is a zip code API?

A ZIP code API, also known as a ZIP code lookup, makes it possible to programmatically look up information using a ZIP code as a unique identifier. In North America, all major shipping carriers including USPS, Canada Post, FedEx, DHL, and UPS maintain various APIs with corresponding documentation.

Can postal code span multiple cities?

When looking at postal codes around the world, there are cases where two different cities are served by the same postal code. For example, the zip code 94608 in California is used for both Emeryville and parts of Oakland. One postal code, two cities.


2 Answers

Two years later, IMO the Google Maps Geocoding API is the best way to go.

Just pass in the postal code as the address parameter:

http://maps.googleapis.com/maps/api/geocode/json?address=94043&sensor=false
like image 74
lreichold Avatar answered Nov 01 '22 22:11

lreichold


You need a service that does geocoding.


Yahoo's Geocoder API is getting much better results globally.

110021 is the postal code for New Delhi among several other places in the world.

This seems to get them all.


Google Maps API is another such service but I'm not happy with the geocoded results as I don't get all results back for 110021.

geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': '110021'}, function(results, status) {
    console.log(results);
});
like image 34
Anurag Avatar answered Nov 01 '22 23:11

Anurag