开发者

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

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question 开发者_如何学编程

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


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


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);
});


The US Post Office sells a subscription to map 5 digit zip codes to City/State values. As @Timothy says, the mapping is one to many. However, the post office db does mark which city/state is the "primary" for a given zip code.

Don't know about other countries. Check with your country's postal authority.

See http://www.usps.com/ncsc/addressinfo/citystate.htm


RedLine offers a free zipcode API service (up to 250 requests per hour). There are 4 different varieties covering distances between two zipcodes, zipcodes within a radius of a zipcode, City, state and Lat/long of a zipcode and the zipcode of a city. http://zipcodedistanceapi.redline13.com/


Just to put in my .02, using the Google Maps API mentioned above, you can look up global information. I am currently working on a project and am pretty much implementing it as my solution for this issue. Ok, off my tiny soap box.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜