Google Maps API 突然停止在我的电子表格上工作

问题描述 投票:0回答:1

我使用 Google Maps Directions API 在 Excel 中实现自定义函数,以查找两个邮政编码之间的距离和行程时间。

今天早上,它突然停止工作了。

我注意到,当您搜索邮政编码时,谷歌地图不再在邮政编码中添加图钉。它只是突出显示一个区域。这会导致新问题吗?

或者更有可能是当地的事情?

我的 TRAVELTIME 和 TRAVELDISTANCE 公式现在会导致 #VALUE 错误。

我刚刚打开了一个我们知道今天早上和昨天可以工作的旧版本,看看我们是否可能一整天不小心损坏了某些东西,但我们遇到了同样的问题。所以这意味着它与 API 有关,或者可能与后台的 JSON 有关。

这是自定义函数之一的 VBA,如果有帮助的话:

Function TRAVELTIME(origin, destination, apikey)

Dim strUrl As String
strUrl = "https://maps.googleapis.com/maps/api/directions/json?origin=" & origin & "&destination=" & destination & "&key=" & apikey
 
Set httpReq = CreateObject("MSXML2.XMLHTTP")
With httpReq
     .Open "GET", strUrl, False
     .Send
End With
 
Dim response As String
response = httpReq.ResponseText
 
Dim parsed As Dictionary
Set parsed = Module2.ParseJson(response)
Dim seconds As Integer
 
Dim leg As Dictionary
 
For Each leg In parsed("routes")(1)("legs")
    seconds = seconds + leg("duration")("value")
Next leg
 
 
 
TRAVELTIME = seconds

结束功能

google-maps-api-3
1个回答
0
投票

问题解决了。我们达到了当天的配额。现在我觉得自己很蠢。

我检查了控制台,但我认为它没有刷新。

© www.soinside.com 2019 - 2024. All rights reserved.