我面臨同樣的問題凝膠定位twitter位置。我發現的最好和免費的服務是openstreetmap。
它真的很容易使用,響應是JSON。
嘗試自己:http://nominatim.openstreetmap.org/search?q=london&format=json&&addressdetails=1&accept-language=en
這裏匹配 「倫敦」 的第一個元素:
{
"place_id": "97592906",
"licence": "Data \u00a9 OpenStreetMap contributors, ODbL 1.0. http:\/\/www.openstreetmap.org\/copyright",
"osm_type": "relation",
"osm_id": "65606",
"boundingbox": [
"51.2867584228516",
"51.6918754577637",
"-0.510375142097473",
"0.334015518426895"
],
"lat": "51.5072759",
"lon": "-0.1276597",
"display_name": "London, Greater London, England, United Kingdom",
"class": "place",
"type": "city",
"importance": 0.9654895765402,
"icon": "http:\/\/nominatim.openstreetmap.org\/images\/mapicons\/poi_place_city.p.20.png",
"address": {
"city": "London",
"county": "London",
"state_district": "Greater London",
"state": "England",
"country": "United Kingdom",
"country_code": "gb"
}
}
正如你可以看到address
字段包含你需要的所有信息。
究竟是我在找什麼。你知道這有沒有限制嗎? –
這裏的使用政策。 http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy – marquez