【问题标题】:Google Maps API - Reverse Geocoding same place_id, JS API returns result but web API does notGoogle Maps API - 反向地理编码相同的 place_id,JS API 返回结果但 Web API 不
【发布时间】:2017-01-22 20:16:12
【问题描述】:

Google 提供了两种检索反向地理编码结果的方法 - 一种网络服务 API:

https://maps.googleapis.com/maps/api/geocode/json?address=place_id:xxxxxxxxxxx&key=YOUR_API_KEY

或 Javascript 地图 API:

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap

我发现 place_id 值使用后者 (js) 而不是前者 (Web 服务) 返回结果 - 返回值为 ZERO_RESULTS (The request did not encounter any errors but, but returned no results)。网络服务是否存在限制?

一个适用于 #2 (js) 而不是 #1 (web service) 的 place_id 值示例:ChIJY01wxrsV64YR40ZRS9kaz_U

网络服务(#1):https://google-developers.appspot.com/maps/documentation/utils/geocoder/embed

Javascript 服务(#2):https://google-developers.appspot.com/maps/documentation/javascript/examples/full/geocoding-place-id

【问题讨论】:

    标签: google-maps-api-3 google-places-api reverse-geocoding


    【解决方案1】:

    据我所知,地理编码 API 的 place_id 不应该有任何限制。我测试了你的询问

    https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJY01wxrsV64YR40ZRS9kaz_U&key=[YOUR_API_KEY]

    并且我能够获得适当的信息(不是您遇到的ZERO RESULTS)。

    您引用的 Web 服务 (#1) 用于地理编码,而不是反向地理编码。如果您将“227 Bedford”绘制到它,您可以通过检查控制台检查它是否具有相同的place_id

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-08
      • 1970-01-01
      • 1970-01-01
      • 2011-05-19
      相关资源
      最近更新 更多