世界城市数据库(Open Street Map?)

时间:2012-07-14 14:35:34

标签: maps openstreetmap opendata

我花了一个下午的时间来寻找世界上最重要城市的开放式数据库,

其中大部分都是高级版,花费400美元,但由于我正在开发一个开源项目,我想使用开放数据,是否有可以下载重要城市名称的地方?

我找到了开放的街道地图,但它是16gb的节点关系之类的东西,但我只需要城市名称和坐标,

非常感谢,

1 个答案:

答案 0 :(得分:16)

这可能比您追求的更多,但您可以使用Overpass API查询键值对["place"="city"]的所有节点。

E.g。转到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"
  }
},

更多信息: