I spent my afternoon looking for open databases with the most important cities all over the world,
most of them are premium and costs something like $400, but since I'm working on a open source project I would like to use open data, is there somewhere where I can download the name of important cities?
I found open street map but it is 16gb of things such as nodes relations, but I only need name of cities and coordinates,
thank you very much,
g
This might be more than you're after, but you could use the Overpass API to query all nodes with a key value pair of ["place"="city"]
.
E.g. go to http://www.overpass-api.de/query_form.html and enter the following:
node
["place"="city"];
out body;
for XML output, or the following for JSON:
[out:json];
node
["place"="city"];
out body;
The output took a minute or so to return to me (it returned 5,000+ nodes), but looks like the following:
<?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>
or the following for 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"
}
},
More info: