【发布时间】:2023-11-13 20:07:02
【问题描述】:
我相信我已经完成了正确设置对距离矩阵 API 的访问的所有工作。
首先,我创建了一个项目和一个结算帐户。该计费帐户已在此项目上启用。
接下来,我启用了距离矩阵 API 并创建了一个不受限制的(目前)API 密钥。
这就是我调用 Google 距离矩阵 API 的方式:
var requestUri = string.Format("https://maps.googleapis.com/maps/api/distancematrix/xml?units=imperial&mode=driving&origins={0}&destinations={1}&KEY={2}", originAddress, destinationAddress, apiKey);
var request = WebRequest.Create(requestUri);
var response = request.GetResponse();
return XDocument.Load(response.GetResponseStream());
然后解析从此方法返回的 XDocument,并提取我请求计算的距离。
但是,在 2500 次请求之后,我收到了带有以下消息的 OVER_QUERY_LIMIT:
You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_
我是否忽略了设置 API 密钥或项目/计费帐户的任何步骤?或者任何人都可以看到我在我的代码中做错了什么?
【问题讨论】:
-
KEY=需要小写key= -
您的 Google 帐户对您的总点击量有何评价?
-
@Coder 它根本没有命中。我应该把它包括在内。它只是告诉我,我达到了我的极限。
-
我今天会尝试@geocodezip 的建议,看看是否可行
-
有什么更新吗?? @terbubbs
标签: .net google-maps-api-3 webrequest google-distancematrix-api