Where can I get a list of Countries, States and Cities? [closed]

不羁岁月 提交于 2019-12-03 00:20:38

问题


This probably seems like a duplicate, since there are identical questions out there.

Unfortunately all of the answers to all of these questions are missing one detail: the states.

Where can I get a list of countries, states and cities?

For example, I want this:

| Sydney  |  New South Wales  |  Australia  |

or

|  Miami  |  Florida          |  United States  |

I don't want something like this, which excludes the state:

|  Miami  |  United States  |

Is there any place where I can get this kind of data?

I've already tried the following data sources:

  • http://www.maxmind.com/app/csv
  • http://www.geodatasource.com/world-cities-database/free
  • http://developer.yahoo.com/geo/geoplanet/data/

But all of them exclude the states.


回答1:


The UN maintains a list of countries and "states" / regions for economic trade. That DB is available here: http://www.unece.org/cefact/locode/welcome.html




回答2:


geonames.org has an api and a data dump of worldwide geographical places.




回答3:


geonames is nice. an export tool based on geonames:

https://github.com/yosoyadri/GeoNames-XML-Builder

https://github.com/yosoyadri/GeoNames-XML-Builder/blob/master/continents-countries-statesprovinces.xml

there's also the excellent pycountry module:

http://pypi.python.org/pypi/pycountry




回答4:


Geonames has a lot of data on places (including towns and cities) but it seems to be contributed and perhaps not complete.

Perhaps also try SQL Dumpster, I've used this website a lot for these kinds of databases, cities, provinces, etc. Unfortunately it's not free but only appears to be a one-time fee.




回答5:


Check this out! It was built no longer ago in 2014.

Get a list of country/state/city in a hierarchy using geonames webservice




回答6:


This may be a sideways answer, but if you download Virtuemart (A Joomla component), it has a countries table and all the related states all set up for you included in the installation SQL. They're called jos_virtuemart_countries and jos_virtuemart_states. It also includes the 2 and 3 character country codes. I'd attach it to my answer, but don't see a way of doing it.



来源:https://stackoverflow.com/questions/9627654/where-can-i-get-a-list-of-countries-states-and-cities

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!