麻烦的例子谷歌地图代码

时间:2012-05-16 18:45:06

标签: google-maps-api-3

执行此操作:

$curl "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"

返回:

{
   "results" : [],
   "status" : "ZERO_RESULTS"
}

为什么不起作用?

干杯!

1 个答案:

答案 0 :(得分:0)

不确定,但是当我直接在浏览器中点击该URL时,我得到相同的结果。它可能与Geocoding Responses section of the Google Maps API Web Services Dev Guide中显示的样本地址有关。也许他们把它关了,因为它超载了?

我甚至尝试了一个URL编码的地址版本:

http://maps.googleapis.com/maps/api/geocode/json?address=1600%20Amphitheatre%20Parkway%2C%20Mountain%20View%2C%20CA&sensor=false

但获得与原始尝试相同的结果。

我可以告诉您,如果您直接转到http://maps.google.com/maps并输入:1600 Amphitheatre Parkway, Mountain View, CA,则 会获得结果。

无论如何,您的网址基本上都是正确的,应该可以使用。尝试使用不同的地址,格式相同,您将获得结果。这对我很好:

http://maps.googleapis.com/maps/api/geocode/json?address=Wrigley+Field&sensor=false

有些跟进,我不确定你在哪里尝试运行代码,但如果它在jsFiddle中,你可能会对这个问题感兴趣:JQuery won't get json?