使用Google地图路线服务查询限制添加多条路线 [英] Add many routes using Google Maps Directions Service Over Query Limit
问题描述
我有一个应用程序需要将很多(有时超过50个)动态路线添加到Google地图。使用DirectionsService,我可以在请求开始失败并且状态为超过查询限制之前,在10个左右的路径上添加。我想知道是否有人遇到过这种情况,并找到了解决办法。看起来,即使我在请求之间暂停,我仍然无法完成前10个任务。不知道是否有单个映射实例的请求限制?
任何与此有关的帮助将不胜感激!
文档,您每秒最多只能获得2个请求。如果你的代码的速度慢于2每秒,那应该没问题。我用
setInterval(function(){....
)来测试它和yup,如果你做得足够慢,看起来可以工作。 http://jsfiddle.net/bd1qdLv3/ p>
I have an application that requires having many (sometimes over 50) dynamic routes added to the google map. Using the DirectionsService, I am able to add right around 10 routes or so before the requests start to fail with the status of "Over Query Limit". I was wondering if anyone has encountered this situation and has found a way to deal with it. It seems that even if I pause between requests, I am still failing for anything over the first 10. Not sure if there is a request limit for a single map instance?
Any help with this would be much appreciated!
According to the documentation, you can only get up to 2 requests per second. If your code do that slower than 2 per second, that should be fine.
I used the setInterval(function(){....
to test it and yup, if you do it slow enough it seems to work.
这篇关于使用Google地图路线服务查询限制添加多条路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!