All Countries States Cities and Zipcodes in a Application

前端 未结 5 1598
Happy的楠姐
Happy的楠姐 2021-02-02 03:48

Is there a way getting all countries, states,cities zipcodes/ in one single database.

I have been looking all over.

I discovered geonames.org, which has I guess

5条回答
  •  长情又很酷
    2021-02-02 04:44

    This will take a little legwork and data munging, but it's not too bad.

    Countries and country codes are easy to come by. Sounds like you already have them.

    Not all countries are divided into states. You may have to simply address these one by one-- there may be some combined reference, but not that I know of.

    U.S. cities are available, and look for things like FIPS codes. There are commercial data providers that will provide you clean, well-organized data, but they are charging for it.

    The post office has some databases with all the zip codes. Note that these charge periodically, and a single zip code doesn't imply a single single (far from it!). And it may not be necessary to actually have a database of all of them, as there are zip verification/correction services available for free.

    For loading the data, check out a recent railscast on the subject.

提交回复
热议问题