【问题标题】:How to get localized names from Google Maps API?如何从 Google Maps API 获取本地化名称?
【发布时间】:2011-06-30 07:38:35
【问题描述】:

我正在尝试从 Google Maps API 以正确的语言获取城市,但它不起作用。例如:

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

-> "LocalityName" : "París" -> 没关系。

但是为什么它不适用于日语例如:

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

有谁知道在哪里可以获得不同语言的城市名称?还有其他服务可以问吗?

谢谢 尼克

【问题讨论】:

    标签: google-maps geo


    【解决方案1】:

    在日本使用 ja 而不是 jp - 请参阅 spreadsheet of supported languages here 获取代码。

    请求http://maps.google.com/maps/geo?hl=ja&output=json&oe=utf8&q=paris应该给你

    {
      "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 ]
        }
      } ]
    }
    

    【讨论】:

    • 嗯,真的很好:-) 我的错!这是以不同语言获取城市名称的最佳方式吗?有人知道另一种更好的方法吗?
    • @Nik 你应该接受这个答案并创建一个新问题。
    猜你喜欢
    • 1970-01-01
    • 2021-10-27
    • 1970-01-01
    • 2021-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-25
    相关资源
    最近更新 更多