database 国家及其城市
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3845006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Of Countries and their Cities
提问by Harsha M V
I need a database of Countries and their Cities.
我需要一个国家及其城市的数据库。
Any idea where I can get such a list?
知道在哪里可以得到这样的清单吗?
采纳答案by pyfunc
There are quite a few available.
有很多可用的。
The following has database for 2,401,039 cities
以下有2,401,039个城市的数据库
回答by Vishnu V Leelakrishnan
From all my searching around, I strongly say that the most practical, accurate and free data source is provided by GeoNames.
通过我的所有搜索,我强烈说最实用、最准确和免费的数据源是由GeoNames提供的。
You can access their data in 2 ways:
您可以通过两种方式访问他们的数据:
- The easy way through their free web services.
- Import their free text files into Database tables and use the data in any way you wish. This method offers much greater flexibility and have found that this method is better.
- 通过他们的免费网络服务的简单方法。
- 将他们的自由文本文件导入数据库表并以您希望的任何方式使用数据。这种方法提供了更大的灵活性,并且发现这种方法更好。
回答by Ajit Kumar
Go through this link http://www.maxmind.com/en/worldcities
通过此链接http://www.maxmind.com/en/worldcities
It Includes the following fields:
它包括以下字段:
- Country Code
- ASCII City Name
- City Name
- Region
- Population
- Latitude (The latitude and longitude are near the center of the most granular location value returned: postal code, city, region, or country)
- Longitude
- 国家代码
- ASCII 城市名称
- 城市名称
- 地区
- 人口
- 纬度(纬度和经度靠近返回的最细粒度位置值的中心:邮政编码、城市、地区或国家/地区)
- 经度
回答by marc_s
Check this out:
看一下这个:
Cities of the world database donated by MaxMind.com
The company MaxMind.com1has agreed to release their cities of the world database under the GPL. The database contains locations by country, city, latitude and longitude. There are over 3,047,000 records in the database. For those of you who have tried the location.module with the zipcodes database from CivicSpace, you will recognize how cool it is and how well this fits with that project and therefore Drupal.
MaxMind.com 1公司已同意在 GPL 下发布他们的世界城市数据库。该数据库包含按国家、城市、纬度和经度划分的位置。数据库中有超过 3,047,000 条记录。对于那些尝试过带有 CivicSpace 邮政编码数据库的 location.module 的人,您会意识到它有多酷,以及它与该项目以及 Drupal 的契合度。
Here's another free onethat might help you get started.
这是另一个可以帮助您入门的免费软件。
Creating and maintaining such a database is quite a bit of work - so anyone who's done it is likely keeping it to themselves, or offering it for a fee.
创建和维护这样一个数据库是一项相当繁重的工作——所以任何完成它的人都可能将它保留给自己,或者提供它以收费。
回答by Kuvalda.Spb.Ru
http://cldr.unicode.org/- common standard multi-language database, includes country list and other localizable data.
http://cldr.unicode.org/- 通用标准多语言数据库,包括国家列表和其他本地化数据。
回答by nelaaro
https://code.google.com/p/worlddb/downloads/list
https://code.google.com/p/worlddb/downloads/list
This database has multi languages country names, region names, city names and they's latitude and longitude number and country's alpha2 code .
该数据库具有多语言国家名称、地区名称、城市名称以及它们的经纬度数字和国家的 alpha2 代码。
回答by Sum None
United Nations list of locations in mdb, csv or txt:
mdb、csv 或 txt 格式的联合国位置列表:
Welcome: http://www.unece.org/cefact/locode/welcome.html
欢迎:http: //www.unece.org/cefact/locode/welcome.html
Choose the downloads link from the above link or just click here.
回答by user2253362
You can use database from here -
您可以从这里使用数据库 -
http://myip.ms/info/cities_sql_database/
http://myip.ms/info/cities_sql_database/
CREATE TABLE `cities` (
`cityID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`cityName` varchar(50) NOT NULL,
`stateID` smallint(5) unsigned NOT NULL DEFAULT '0',
`countryID` varchar(3) NOT NULL DEFAULT '',
`language` varchar(10) NOT NULL DEFAULT '',
`latitude` double NOT NULL DEFAULT '0',
`longitude` double NOT NULL DEFAULT '0',
PRIMARY KEY (`cityID`),
UNIQUE KEY `unq` (`countryID`,`stateID`,`cityID`),
KEY `cityName` (`cityName`),
KEY `stateID` (`stateID`),
KEY `countryID` (`countryID`),
KEY `latitude` (`latitude`),
KEY `longitude` (`longitude`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
回答by Ganesh S
I was comparing worldcitiesdatabae.info with www.worldcitiesdatabase.comand it appears the latter one to be more resourceful. However, maxmind has a free database so then why buy a cities database. Just get the free one and there is lot of help available on internet about maxmind db. If you put in extra efforts then you can save those few bucks :)
我将 worldcitiesdatabae.info 与www.worldcitiesdatabase.com进行了比较,似乎后者更足智多谋。然而,maxmind 有一个免费的数据库,那么为什么要购买一个城市数据库。只需获得免费的,互联网上就有很多关于 maxmind db 的帮助。如果您付出额外的努力,那么您可以节省那几块钱:)
回答by Yiannis
This service returns Countries (name,code) and cities for any country as REST, SErvice. You can also download database and sample REST service
此服务将任何国家/地区的国家/地区(名称、代码)和城市作为 REST、服务返回。您还可以下载数据库和示例 REST 服务
http://tecorange.com/content/world-countries-and-cities-restjson-service-12-months-subscription
http://tecorange.com/content/world-countries-and-cities-restjson-service-12-months-subscription