Search code examples
google-mapscordovagoogle-maps-api-3phonegap

Avoid over_query_limit license


I currently have an application based on phonehap cordova and makes use of the maps and services of google mpas.

Some of these services are the geocoding and Directions service, with the geocoding I had problems about the "Over query limit" when geocoding more than 250 addresses so I had to implement the use of SetTimeout and delays in time not to send more than 10 Or 20 requests per second. As with geocoding is made use of the service Directions Service in which routes are made on the map and which sometimes also throws the error "Over_query_limit" so that also makes a setTimeout or a timeout in each Routing request.

But this timeout or setTimeout causes the application to slow down by doing these processes for what we already know.

According to this problem and the different plans and tariffs that google offers which of them could serve me to cover mainly these two problems?


Solution

  • The client side per session limits are the same for Premium and Standard plans. You can execute 10 initial requests and after that 1 request per second.

    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

    In order to solve the issue you should create server side code and call web services as suggested in documentation. With web services you will have 50 QPS and 2500 daily request for free (100K daily requests with Billing enabled) in Standard plan. With Premium plan there is no daily limit and you have 50 QPS as well.

    Have a look at documentation for further details

    https://developers.google.com/maps/documentation/geocoding/usage-limits