google-maps - 谷歌距离矩阵API : Maximal number of arguments?

标签 google-maps google-distancematrix-api

我可以为此功能指定的最大出发地和目的地数量是多少? 或者更好:我可能要求的出发地-目的地组合的最大数量是多少?

现在我有 33 个出发地和 3 个目的地 - 并且它正在工作。 当我再输入一个目的地时,就会发生错误。 它说的是类似的事情

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 223, in _get
    result = self._get_body(resp)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 242, in _get_body
    raise googlemaps.exceptions._RetriableRequest()
googlemaps.exceptions._RetriableRequest

During handling of the above exception, another exception occurred:

我在最后有这些行 12 次

Traceback (most recent call last):
  File "C:\Python34\Lib\site-packages\googlemaps\distance_matrix_test.py", line 41, in <module>
    '28821 Coslada','10179 Berlin'], mode='driving')
  File "C:\Python34\Lib\site-packages\googlemaps\distance_matrix.py", line 130, in distance_matrix
    return client._get("/maps/api/distancematrix/json", params)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 229, in _get
    base_url, accepts_clientid, extract_body)
  File "C:\Python34\lib\site-packages\googlemaps\client.py", line 184, in _get
    raise googlemaps.exceptions.Timeout()
googlemaps.exceptions.Timeout

很高兴能得到您的帮助!顺便说一句:我检查了附加地址 - 这不会导致问题。它必须是地址的数量。但我想就此获得专业意见......

谢谢!!!

最佳答案

摘自 Google Maps Distance Matrix API Usage Limits 的文档:

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.

The Google Maps Distance Matrix API has the following limits in place:

Standard Usage Limits
Users of the standard API:

  • 每天 2,500 个免费元素
  • 每个查询 100 个元素
  • 每 10 秒 100 个元素

当您提交尺寸为 33 x 3 的矩阵时,您只有 99 个元素,这在免费服务级别的限制内。但是,当您再添加一个目的地时(为您提供一个尺寸为 34 ​​x 333 x 4 的矩阵),您超过了 100,因此出现错误。

您的选择包括选择高级服务,它为您提供每个查询最多 625 个元素,或者以某种方式减少输入矩阵的大小。

关于google-maps - 谷歌距离矩阵API : Maximal number of arguments?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36844300/

相关文章:

python - 谷歌距离矩阵 API : How to specify origin-destination pairs?

google-maps - url中的谷歌地图缩放参数不起作用

android - java.lang.IllegalStateException : no included points in fragment in android 错误

javascript - getPlace 函数无法在 React 中与 Google Autocomplete 配合使用

javascript - Google map 距离矩阵 Api 中的目的地有多少限制?

ios - iOS 应用程序中具有多个值的 Google Maps Distance Matrix Api

swift - Iphone 7 和 iOS 10.1.1 上的谷歌地图无法正常工作

javascript - 谷歌地图API错误: initMap is not a function

javascript - 距离矩阵不返回大数据的距离

google-maps - 谷歌地图距离矩阵错误结果