Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。
想改善这个问题吗?更新问题,以便将其作为on-topic用于堆栈溢出。
6年前关闭。
Improve this question
整个下午,我都在寻找世界上最重要的城市的开放数据库,
它们中的大多数都是高级软件,价格约为400美元,但是由于我从事的是开放源代码项目,所以我想使用开放数据,有没有可以下载重要城市名称的地方?
我找到了开放的街道地图,但它是节点关系等16gb的东西,但是我只需要城市名称和坐标,
非常感谢你,
G
用于XML输出,或用于JSON的以下内容:
输出花了大约一分钟时间才返回给我(它返回了5,000多个节点),但是看起来像下面这样:
或以下JSON:
更多信息:
http://wiki.openstreetmap.org/wiki/Tag:place%3Dcity http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Find_something
想改善这个问题吗?更新问题,以便将其作为on-topic用于堆栈溢出。
6年前关闭。
Improve this question
整个下午,我都在寻找世界上最重要的城市的开放数据库,
它们中的大多数都是高级软件,价格约为400美元,但是由于我从事的是开放源代码项目,所以我想使用开放数据,有没有可以下载重要城市名称的地方?
我找到了开放的街道地图,但它是节点关系等16gb的东西,但是我只需要城市名称和坐标,
非常感谢你,
G
最佳答案
这可能比您想做的要多,但是您可以使用Overpass API查询键值对为["place"="city"]
的所有节点。
例如。转到http://www.overpass-api.de/query_form.html并输入以下内容:
node
["place"="city"];
out body;
用于XML输出,或用于JSON的以下内容:
[out:json];
node
["place"="city"];
out body;
输出花了大约一分钟时间才返回给我(它返回了5,000多个节点),但是看起来像下面这样:
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API">
<note>The data included in this document is from www.openstreetmap.org. It has there been collected by a large group of contributors. For individual attribution of each item please refer to http://www.openstreetmap.org/api/0.6/[node|way|relation]/#id/history </note>
<meta osm_base="2012-07-22T13:38:02Z"/>
<node id="107775" lat="51.5072759" lon="-0.1276597">
<tag k="capital" v="yes"/>
<tag k="is_in" v="England, United Kingdom, UK, Great Britain, Europe"/>
<tag k="is_in:continent" v="Europe"/>
<tag k="is_in:country" v="United Kingdom"/>
<tag k="name" v="London"/>
<tag k="name:ast" v="Londres"/>
<tag k="name:be" v="Лондан"/>
<tag k="name:br" v="Londrez"/>
<tag k="name:cs" v="Londýn"/>
<tag k="name:cy" v="Llundain"/>
<tag k="name:de" v="London"/>
<tag k="name:el" v="Λονδίνο"/>
<tag k="name:en" v="London"/>
<tag k="name:eo" v="Londono"/>
<tag k="name:es" v="Londres"/>
<tag k="name:fa" v="لندن"/>
<tag k="name:fi" v="Lontoo"/>
<tag k="name:fr" v="Londres"/>
<tag k="name:ga" v="Londain"/>
<tag k="name:gd" v="Lunnainn"/>
<tag k="name:gv" v="Lunnin"/>
<tag k="name:he" v="×œ×•× ×“×•×Ÿ"/>
<tag k="name:is" v="Lundúnir"/>
<tag k="name:it" v="Londra"/>
<tag k="name:ja" v="ãƒãƒ³ãƒ‰ãƒ³"/>
<tag k="name:ku" v="London"/>
<tag k="name:la" v="Londinium"/>
<tag k="name:lv" v="Londona"/>
<tag k="name:nl" v="Londen"/>
<tag k="name:pl" v="Londyn"/>
<tag k="name:pt" v="Londres"/>
<tag k="name:ru" v="Лондон"/>
<tag k="name:sk" v="Londýn"/>
<tag k="name:sr" v="Лондон"/>
<tag k="name:sv" v="London"/>
<tag k="name:uk" v="Лондон"/>
<tag k="name:vi" v="Luân Äôn"/>
<tag k="name:zh" v="伦敦"/>
<tag k="name:zh_pinyin" v="Lúndūn"/>
<tag k="note" v="Centre of London classed as on the charles I moment near trafalgar square"/>
<tag k="place" v="city"/>
<tag k="population" v="7556900"/>
<tag k="rank" v="0"/>
<tag k="wikipedia" v="http://en.wikipedia.org/wiki/London"/>
<tag k="wikipedia:en" v="London"/>
<tag k="wikipedia:fr" v="Londres"/>
</node>
或以下JSON:
{
"version": 0.6,
"generator": "Overpass API",
"osm3s": {
"timestamp_osm_base": "2012-07-22T14:02:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. It has there been collected by a large group of contributors. For individual attribution of each item please refer to http://www.openstreetmap.org/api/0.6/[node|way|relation]/#id/history"
},
"elements": [
{
"type": "node",
"id": 107775,
"lat": 51.5072759,
"lon": -0.1276597,
"tags": {
"capital": "yes",
"is_in": "England, United Kingdom, UK, Great Britain, Europe",
"is_in:continent": "Europe",
"is_in:country": "United Kingdom",
"name": "London",
"name:ast": "Londres",
"name:be": "Лондан",
"name:br": "Londrez",
"name:cs": "Londýn",
"name:cy": "Llundain",
"name:de": "London",
"name:el": "Λονδίνο",
"name:en": "London",
"name:eo": "Londono",
"name:es": "Londres",
"name:fa": "لندن",
"name:fi": "Lontoo",
"name:fr": "Londres",
"name:ga": "Londain",
"name:gd": "Lunnainn",
"name:gv": "Lunnin",
"name:he": "×œ×•× ×“×•×Ÿ",
"name:is": "Lundúnir",
"name:it": "Londra",
"name:ja": "ãƒãƒ³ãƒ‰ãƒ³",
"name:ku": "London",
"name:la": "Londinium",
"name:lv": "Londona",
"name:nl": "Londen",
"name:pl": "Londyn",
"name:pt": "Londres",
"name:ru": "Лондон",
"name:sk": "Londýn",
"name:sr": "Лондон",
"name:sv": "London",
"name:uk": "Лондон",
"name:vi": "Luân Äôn",
"name:zh": "伦敦",
"name:zh_pinyin": "Lúndūn",
"note": "Centre of London classed as on the charles I moment near trafalgar square",
"place": "city",
"population": "7556900",
"rank": "0",
"wikipedia": "http://en.wikipedia.org/wiki/London",
"wikipedia:en": "London",
"wikipedia:fr": "Londres"
}
},
更多信息:
10-05 22:31