Google提供了两种检索反向地理编码结果的方法 - 一种Web服务API:
https://maps.googleapis.com/maps/api/geocode/json?address=place_id:xxxxxxxxxxx&key=YOUR_API_KEY
或Javascript Map 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)
. Web服务是否存在限制?
与#2(js)而不是#1(Web服务)一起使用的示例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
1 回答
根据我所知,对Geocoding API的place_ids应该没有任何限制 . 我测试了你的询问
https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJY01wxrsV64YR40ZRS9kaz_U&key=[YOUR_API_KEY]
我能够得到相应的信息(不是你遇到的
ZERO RESULTS
) .您引用的Web服务(#1)用于地理编码,而不是反向地理编码 . 如果您将"227 Bedford"绘制到它,您可以通过检查控制台检查它是否具有相同的
place_id
.