Address geocode via jquery geocoder.geocode (400 Items)

谁说我不能喝 提交于 2019-12-02 13:18:36

There is a per session quota for geocoder service as stated in the documentation:

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 requests. Once you use this quota, the API enforces rate limits on additional requests on a per-second basis. If too many requests are made within a certain time period, the API returns an OVER_QUERY_LIMIT response code.

The per-session rate limit prevents the use of client-side services for batch requests, such as batch geocoding. For batch requests, use the Google Maps Geocoding API web service.

https://developers.google.com/maps/documentation/javascript/geocoding#UsageLimits

So, you should throttle your client side calls and execute 1 request per second after initial 10 requests or implement a server side batch geocoding with Geocoding API web service where you can have up to 50 requests per second.

By the way in your code you try execute all requests after 1 second. You should increase a delay for each next request.

setTimeout(function () {
    //Your code
}, 1000 * i);

So the first request will be executed immediately, the second after 1 sec, the third after 2 seconds and so on.

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