google-maps - 包含 2 个以上元素的 Google map 距离矩阵返回 OVER_QUERY_LIMIT

标签 google-maps google-distancematrix-api

我真的怀疑自己的理智,希望有人能提供帮助。

使用 2 个元素查询 google map 距离矩阵效果很好(1 个起点,2 个目的地):

$ curl "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=Victoria+BC|San+Francisco&key=$GOOGLE_MAPS_API_KEY"

如果有 3 个或更多元素,我总是会收到 OVER_QUERY_LIMIT 错误:

$ curl "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=Victoria+BC|San+Francisco|New+York&key=$GOOGLE_MAPS_API_KEY"
{
   "destination_addresses" : [],
   "error_message" : "You have exceeded your rate-limit for this API.",
   "origin_addresses" : [],
   "rows" : [],
   "status" : "OVER_QUERY_LIMIT"
}

基于standard usage limits (粘贴在下面),我不应该在只有 3 个元素(1 个起点和 3 个目的地)的单个请求中看到此错误。

Each query sent to the Google Maps Distance Matrix API is limited by the number of allowed elements, where the number of origins times the number of destinations defines the number of elements.

  • 2,500 free elements per day, calculated as the sum of client-side and server-side queries.
  • Maximum of 25 origins or 25 destinations per request.
  • 100 elements per request.
  • 100 elements per second, calculated as the sum of client-side and server-side queries.

无论 2 个查询的顺序如何,该模式都成立。 2 元素查询始终成功,3 元素查询始终失败。有什么想法吗?

编辑:刚刚尝试了 3 个起点和 1 个目的地,得到了相同的结果,因此它似乎肯定与请求中的元素数量有关。

最佳答案

如果它对其他人有帮助,它看起来像是此 API 强制执行自定义配额限制的方式中的一个错误。如果您将限制重置回默认值(通过开发人员控制台/API 仪表板),您应该获得预期的行为:

  • 每天元素:2,500
  • 每 100 秒的元素:10,000
  • 每个用户的元素:无限制

关于google-maps - 包含 2 个以上元素的 Google map 距离矩阵返回 OVER_QUERY_LIMIT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48027387/

相关文章:

javascript - 为什么我的 map 不在 jQuery 选项卡中呈现?

javascript - 如何触发 Google map 'DrawingManager' 绘图的*开始*?

google-maps - Google map API 和 duration_in_traffic

android - 两个地点之间的距离(不显示 map )

javascript - JSON 嵌套元素未定义

r - 在 R 中用 ggplot 绘制谷歌地图

android - 刷新许多谷歌地图标记位置,而无需在 Android 中刷新整个 map

javascript - 从文本地址框创建链接以自动转到 Google map 街景

java - 谷歌的距离矩阵API也考虑 "Elevation"吗?