Google Elevation API - limits
-
03-12-2019 - |
Question
I'm developing a map application that uses Google Elevation API. Today I spotted that I get OVER_QUERY_LIMIT response. It is clear that I have reached my quota. Of course I have read documentation: http://code.google.com/apis/maps/documentation/elevation/#Limits. There is a one thing I cannot understand though. Thus I have a question for you.
I pass only two points as a path but I want it to be divided into 250 steps. Does the following query gets info about 250 locations or two only?
http://maps.googleapis.com/maps/api/elevation/json?path=90.828934,-33.938923|92.983400,-2.552155&mapclient=flashapi&sensor=false&samples=250&key=KEY=xt&url=URL
I think it was impossible for me to check 25 000 locations in one day but if the above mentioned query gets 250 locations instead of two, then I have a problem :)
Thanks
Solution
In my experience, and according to the documentation, your request does count as 250 locations. Maybe you should use a lower number of steps and interpolate.
Keep in mind that even if it wouldn't, you are also subjected to a 2,500 requests per day limit.
OTHER TIPS
A bit late, but someone might find it useful...
From the API documentation:
"Use of the Google Elevation API is subject to a limit of 2,500 requests per day... In each given request you may query the elevation of up to 512 locations"
I read that as saying a batch request counts as a single request so that shouldn't be the problem.
However, the Google Elevation API (and their other map APIs) also return OVER_QUERY_LIMIT
if you access them to often in a short period of time.
"Additionally, we enforce a request rate limit to prevent abuse of the service."
To deal with this, in my functions I build in a wait parameter. This progressively increases the length of time between calls until either a response which isn't until OVER_QUERY_LIMIT
is received, or until the wait is >500 ms (or other duration, depending on the application). If it's still returning OVER_QUERY_LIMIT
I return OVER_HARD_QUERY_LIMIT
to show that I've reached the limit for the day.