An open source SQL database for the list of towns

2020-05-06 01:27发布

I am looking for a list of towns, cities by country (the countries I mean here are all countries that exist on planet Earth). Is there any open-source SQL database available online which I can download and use, or any geography social network sites APIs I can use?

Or is it something I have to make it up myself? - I hope not!

3条回答
倾城 Initia
2楼-- · 2020-05-06 02:07

There is a sample database for PostgreSQL with that information. I don't know how outdated it is, though...

It's hosted in http://pgfoundry.org/projects/dbsamples/.

查看更多
Melony?
3楼-- · 2020-05-06 02:07

This gives you the SQL to insert a list of countries into a table - 239 of them:

http://www.sqldumpster.com/databases/geographic/

Look for "Countries (and ISO codes)"

Didn't find anything obvious for the cities and towns. Maybe you can use the countries list an make a crawler to find them.

查看更多
够拽才男人
4楼-- · 2020-05-06 02:15

Try this:

The downloadable file contains a list of all towns, administrative divisions and agglomerations with their current population, their English name (if not equal to the international name) and parent country. The international names are displayed in UTF-8 format, which means that special characters which are not displayable with a normal text editor, are displayed as two characters. A freeware text editor that can read UTF-8 characters is UniRed. When opening the file with UniRed you have to specify the charset UTF-8.

http://www.world-gazetteer.com/wg.php?x=1129163518&men=stdl&lng=en&gln=xx&dat=32&srt=npan&col=aohdq

查看更多
登录 后发表回答