Add many routes using Google Maps Directions Service Over Query Limit

泄露秘密 提交于 2019-12-25 18:36:29

问题


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!


回答1:


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.

http://jsfiddle.net/bd1qdLv3/



来源:https://stackoverflow.com/questions/29827891/add-many-routes-using-google-maps-directions-service-over-query-limit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!