Place Details API的short_name更改

时间:2017-04-24 19:09:06

标签: google-maps google-places-api

Google响应的格式是否有变化? 几天后,当我使用与某个国家/地区相对应的place_id参数查询API时,我不再获得任何国家/地区代码(alpha2)。

例如:

# Query for "France"
# http://maps.googleapis.com/maps/api/js/GeocodeService.Search?7sUS&9sen&14sChIJMVd4MymgVA0R99lHx5Y__Ws&key=[API_KEY]

"results" : [
  {
     "address_components" : [
        {
           "long_name" : "France",
           "short_name" : "France", <= Used to be "FR"
           "types" : [ "country", "political" ]
        }
     ],
     "formatted_address" : "France",
       ....
     },
     "place_id" : "ChIJMVd4MymgVA0R99lHx5Y__Ws",
     "types" : [ "country", "political" ]
  }
  ],
  "status" : "OK"
  }

但是当我对法国巴黎执行相同的查询时:

"results" : [
  {
     "address_components" : [
        {
           "long_name" : "Paris",
           "short_name" : "Paris",
           "types" : [ "locality", "political" ]
        },
        {
           "long_name" : "Paris",
           "short_name" : "Paris",
           "types" : [ "administrative_area_level_2", "political" ]
        },
        {
           "long_name" : "Île-de-France",
           "short_name" : "Île-de-France",
           "types" : [ "administrative_area_level_1", "political" ]
        },
        {
           "long_name" : "France",
           "short_name" : "FR",  <== Still "FR"
           "types" : [ "country", "political" ]
        }
     ],
     "formatted_address" : "Paris, France",
     "geometry" : {
        "bounds" : {
           "northeast" : {
              "lat" : 48.9021449,
              "lng" : 2.4699208
           },
           "southwest" : {
              "lat" : 48.815573,
              "lng" : 2.224199
           }
        },
        "location" : {
           "lat" : 48.856614,
           "lng" : 2.3522219
        },
        "location_type" : "APPROXIMATE",
        "viewport" : {
           "northeast" : {
              "lat" : 48.9021449,
              "lng" : 2.4699208
           },
           "southwest" : {
              "lat" : 48.815573,
              "lng" : 2.225193
           }
        }
     },
     "place_id" : "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
     "types" : [ "locality", "political" ]
  }
  ],
  "status" : "OK"
  }
  )

它真的改变了吗?如果是这样,我如何获得有关某个国家/地区的查询的相应country_code?

感谢您的帮助

1 个答案:

答案 0 :(得分:6)

这似乎是一个错误。请查看公共问题跟踪器中的报告:

https://issuetracker.google.com/issues/37479392

随意添加您的评论并解决问题。

<强>更新

Google于2017年4月27日解决了该问题。