开发者

How to get localized names from Google Maps API?

I am trying to obtain from the Google Maps API the city in the right language, but it doesn't work. For example:

http://maps.google.com/maps/geo?hl=es&output=json&oe=utf8&q=paris

-> "LocalityName" : "París" - > this is ok.

but why it is not working for Japanese for example:

http://maps.google.com/maps/geo?hl=jp开发者_JS百科&output=json&oe=utf8&q=paris

Has any one any idea where I can get city names in different languages? Is there another service where I can ask?

Thanks Nik


Use ja rather than jp for Japan - see the spreadsheet of supported languages here for the codes.

Requesting http://maps.google.com/maps/geo?hl=ja&output=json&oe=utf8&q=paris should give you

{
  "name": "paris",
  "Status": {
    "code": 200,
    "request": "geocode"
  },
  "Placemark": [ {
    "id": "p1",
    "address": "パリ, フランス",
    "AddressDetails": {
   "Accuracy" : 4,
   "Country" : {
      "AdministrativeArea" : {
         "AdministrativeAreaName" : "イル・ド・フランス",
         "SubAdministrativeArea" : {
            "Locality" : {
               "LocalityName" : "パリ"
            },
            "SubAdministrativeAreaName" : "パリ"
         }
      },
      "CountryName" : "フランス",
      "CountryNameCode" : "FR"
   }
},
    "ExtendedData": {
      "LatLonBox": {
        "north": 48.9153630,
        "south": 48.7979015,
        "east": 2.4790465,
        "west": 2.2229277
      }
    },
    "Point": {
      "coordinates": [ 2.3509871, 48.8566667, 0 ]
    }
  } ]
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜