简体   繁体   English

Google Maps API 距离矩阵 - 延迟请求(客户端)另外 100 个元素的时间

[英]Google Maps API Distance Matrix - Delay time to request (client-side) another 100 elements

I have a mini-map project that uses Distance Matrix Google Maps API to create a polyline (route) from start point to end point.我有一个迷你地图项目,它使用距离矩阵 Google Maps API 创建从起点到终点的折线(路线)。 I have many markers in my map and I have to connect them using Distance Matrix API to fetch the duration value.我的地图中有很多标记,我必须使用距离矩阵 API 将它们连接起来以获取持续时间值。

The problem is the total requests of the Distance Matrix API are more than 100 elements, exactly 400 elements.问题是距离矩阵 API 的总请求超过 100 个元素,正好是 400 个元素。 I know that Google Maps API limit only to 100 elements per client-side request.我知道 Google Maps API 将每个客户端请求限制为 100 个元素。 According to the documentation,根据文档,

While you are no longer limited to a maximum number of elements per day (EPD), the following usage limits are still in place for the Distance Matrix API:虽然您不再受到每天最大元素数 (EPD) 的限制,但距离矩阵 API 仍然存在以下使用限制:

Maximum of 25 origins or 25 destinations per request.每个请求最多 25 个起点或 25 个目的地。 Maximum 100 elements per server-side request.每个服务器端请求最多 100 个元素。 Maximum 100 elements per client-side request.每个客户端请求最多 100 个元素。 1000 elements per second (EPS), calculated as the sum of client-side and server-side queries.每秒 1000 个元素 (EPS),计算为客户端和服务器端查询的总和。

So, I decide to divide the 400 elements into 4 requests (100 elements each).因此,我决定将 400 个元素分成 4 个请求(每个请求 100 个元素)。 However, the documentation doesn't state how long should I wait to request another 100 elements.但是,文档没有说明我应该等待多长时间来请求另外 100 个元素。

Does anyone know?有人知道吗?

Thank you.谢谢你。

Google's documentation does say how long you should wait here: Google 的文档确实说明了您应该在这里等待多长时间:

Note: The rate limit is applied per user session, regardless of how many users share the same project.注意:速率限制适用于每个用户会话,无论有多少用户共享同一个项目。 When you first load the API, you are allocated an initial quota of elements.首次加载 API 时,会为您分配一个初始配额。 Once you use this quota, the API enforces rate limits on additional requests on a per-second basis.使用此配额后,API 会以每秒为基础对额外请求实施速率限制。 If too many requests are made within a certain time period, the API returns an OVER_QUERY_LIMIT response code.如果在特定时间段内发出过多请求,API 将返回 OVER_QUERY_LIMIT 响应代码。

So you'll need to wait at least 1 second before you make another request to the Distance Matrix client-side service.因此,您需要等待至少 1 秒钟,然后才能向距离矩阵客户端服务发出另一个请求。

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Maps Javascript API距离矩阵请求限制 - Google Maps Javascript API Distance Matrix Request Limitations 您是否需要为客户端应用程序使用Google Maps API的API密钥? - Do you need to use API key for google maps API for client-side applications? 传递带有Google Maps Distance Matrix请求的标识符 - Passing an Identifier with a Google Maps Distance Matrix Request 缓存Google Maps客户端地理编码结果 - Cache Google Maps client-side geocoding results Google Maps JavaScript API 的 Google Maps Distance Matrix 语言规范 - Google Maps Distance Matrix Language specification for Google Maps JavaScript API 使用谷歌地图距离矩阵api JSON输出获取距离 - get distance using google maps distance matrix api JSON output Next js - 在 Vercel 中部署时出现 react-google-maps/api 错误:发生客户端异常 - Next js - react-google-maps/api error when deploying in Vercel : A client-side exception has occurred 从API请求获取输出(客户端) - Getting the output from an API request (client-side) 如何刷新客户端的Google API访问令牌? - How to refresh a client-side Google api access token? 客户端对Google自定义搜索API的请求数量是否受到限制? - Is the number of Client-Side requests for Google Custom Search API limited?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM