Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect that the 25000 request per day limit has been reached in Google Maps?

I'm working on a website using the Google Maps Javascript API v3.

The free version of the API is limited by 25000 requests a day. But what happens if this limit is reached?

Is there a way to detect that the request limit has been reached so a fallback Google Maps Image API map can be displayed instead?

like image 426
Guillaume Flandre Avatar asked Dec 29 '11 08:12

Guillaume Flandre


2 Answers

The usage limit is based on site or application, not the client IP address.

You can use the Google API console to monitor your usage if you add an API key to each of your map requests. I have not seen a way to query the usage programmatically. https://code.google.com/apis/console

Per the comment below by @alds, it does appear that JS Maps API v3 and Static Maps API are separate services, therefore having separate request limits. Falling back to a static Google map image could help.

This also explains the usage limits in better detail: http://googlegeodevelopers.blogspot.com/2011/11/understanding-how-maps-api-usage-limits.html

like image 100
jasonyork Avatar answered Sep 27 '22 20:09

jasonyork


You cannot detect via the API that the request limit has been reached. There are no events that are fired and the API does not expose a function or property to determine that the API quota has been reached.

Google has decided that this is not a feature they will implement.

https://issuetracker.google.com/issues/35830575#comment12

like image 25
PaulC Avatar answered Sep 27 '22 20:09

PaulC