32

What are the limits for client side geocoding with Google Maps JavaScript API v3?


My research:

  1. Google Maps PHP API has a limit of 2500 geocode requests per day (https://developers.google.com/maps/documentation/geocoding/#Limits)
  2. Google Maps Javascript API v3 has a limit of 25000 map loads per day (https://developers.google.com/maps/documentation/javascript/usage)
  3. Google suggests using javascript API for geoocoding to avoid the 2500 limit through the PHP API. It states "running client-side geocoding, you generally don't have to worry about your quota" (https://developers.google.com/maps/articles/geocodestrat#client)

However, nowhere does it state in any of the documentation what the geocoding limits are through the Google Maps JavaScript API v.3.

(This has been bothering me for a while, and I have researched it on more than one occasion and failed to find a solid answer)

geocodezip
  • 158,664
  • 13
  • 220
  • 245
cantaffordavan
  • 1,427
  • 4
  • 24
  • 44

5 Answers5

72

I work in Maps for Business support at Google. The following is my personal opinion, not Google's, but let's just say I'm rather familiar with this topic!

First, it's important to distinguish between client-side geocoding (JavaScript calls to google.maps.Geocoder) and server-side geocoding (HTTP requests to /maps/api/geocode). This question and answer are specifically about client-side geocoding; for server-side limits, see here. In particular, the oft-mentioned 2,500 requests per IP per day limit applies only to server-side geocoding, not client-side.

So the short answer is, there is no documented query limit specifically for client-side geocoding. Once a client has loaded the Google Maps JavaScript API library, it can make as many geocode requests as it likes, provided they're done at a sane speed. Two rules of thumb to ensure you don't run into problems:

  1. Initiate geocoding in response to user interaction, and you'll be fine even if there are short request bursts (eg. click a button to geocode several addresses).
  2. Catch any OVER_QUERY_LIMIT errors and handle them gracefully (eg. exponential backoff). Here is some sample code in Python.

But please do not try to busy-loop the geocoder or hammer away at it for hours on end, there are protections against abuse.

UPDATE

As of 2017 the client side quota is calculated against corresponding web service quota. Please have a look at Christophe Roussy's answer.

xomena
  • 31,125
  • 6
  • 88
  • 117
lambshaanxy
  • 22,552
  • 10
  • 68
  • 92
  • This is the answer I was looking for (I hoped a Google affiliated person would chime in, so perfect!). – cantaffordavan Jan 07 '14 at 18:56
  • Does this apply to client-side calls to the google.maps namespace? Or is this just for JSON requests for geocoding information? – user3308043 Aug 02 '14 at 22:37
  • 2
    "This question and answer are specifically about *client-side* geocoding." – lambshaanxy Aug 20 '14 at 22:26
  • 1
    So, does the so-called client-side geocoding only apply to a javascript client? If in my case it is lots of mobile native app client sending HTTP request to the geocoding service (or more precisely, the Google Places NearbySearch API), am I still limited by the server-side quota? Hope @jpatokal can elaborate. Thanks in advance! – RayLuo Aug 26 '14 at 18:14
  • Client-side = JavaScript calls to the google.maps.Geocoder object, server-side = HTTP requests to /maps/api/geocode. You're calling the HTTP service, so it's server-side. However, the Places API is an entirely different service with its own rules: https://developers.google.com/places/usage – lambshaanxy Aug 26 '14 at 22:13
  • Thanks @jpatokal. So in other words, there will be no "client-side" api for native app developers although they are traditionally considered as always working on client-side/front-end app. Sounds ironic. BTW, rumors say that a navigation app is not allowed to use google geocoding api or Places API. Is that true? – RayLuo Aug 26 '14 at 22:32
  • You can use `android.location.Geocoder` if you want a "client side" API for Android. http://developer.android.com/reference/android/location/Geocoder.html – lambshaanxy Aug 26 '14 at 23:55
  • FYI: The android.location.Geocoder does not provide the same results as the google maps geocoder. I am moving to the google maps geocoder because it provides better addresses when reverse geocoding. – Howard Swope Sep 07 '16 at 22:04
13

Always read the latest you can find on an official Google website for the proper API version, a dated stackoverflow answer is not an up-to-date reference !!!

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

Here is what it said when I wrote this answer:

Google Maps Geocoding API Usage Limits

2,500 free requests per day, calculated as the sum of client-side and server-side queries.

50 requests per second, calculated as the sum of client-side and server-side queries.

Enable pay-as-you-go billing to unlock higher quotas:

$0.50 USD / 1000 additional requests, up to 100,000 daily.

In general I think Google is happy as long as the queries come from real human users as this is of some value to them.

There are also ways to save a few requests by caching results for up to 30 days: https://developers.google.com/maps/premium/optimize-web-services#optimize

Community
  • 1
  • 1
Christophe Roussy
  • 16,299
  • 4
  • 85
  • 85
2

Based on https://developers.google.com/maps/articles/geocodestrat,

Client-side geocoding through the browser is rate limited per map session, so the geocoding is distributed across all your users and scales with your userbase.

So, what is rate limits per map session?

As geocoding limits are per user session, there is no risk that your application will reach a global limit as your userbase grows. Client-side geocoding will not face a quota limit unless you perform a batch of geocoding requests within a user session. Therefore, running client-side geocoding, you generally don't have to worry about your quota.

Ok, what is the limit? Here we go

https://developers.google.com/maps/documentation/business/articles/usage_limits

With a rate limit or 10 QPS (queries per second), on sending the 11th request your application should check the timestamp of the first request and wait until 1 second has passed. The same should be applied to daily limits.

Still not clear? me too.

This is the closet answer that I found from their document and it says "rate limit of 10 requests per second"

https://developers.google.com/maps/documentation/business/webservices/quota

I don't think a user session can send 10 requests per second, thus I consider it as limitless.

allenhwkim
  • 27,270
  • 18
  • 89
  • 122
  • 1
    The "Usage Limits" article you link to is about web services (server-side), not client-side. Also, 10 QPS is the Maps for Business limit for server-side geocoding, not the free API user limit (which is 1 QPS). – lambshaanxy Jan 06 '14 at 22:51
  • "I don't think a user session can send 10 requests per second, thus I consider it as limitless." What if I want to show a map for the user displaying 20 addresses? Then I want to show them as quickly as possible, so 20 requests per second is very much possible. Do I have to slow it down then and make the user wait? – Tom Oct 22 '15 at 14:31
  • Google likes client-side user queries, as they can get information from human geocoding need (good for ads ...). This is why the limit is much better for this case. – Christophe Roussy May 18 '17 at 08:18
0

I asked this recently about the Places library (or rather, researched it and came to a conclusion):

Regarding Places Library for Google Maps API Quota limits

Basically, it seems that Map loads with key are limited to 25,000 per day per domain (that might not be right, but i'm pretty sure thats the case).

Geocoding limits are limited in the following way:

2,500 if you're using an API key without setting up billing 100,000 if you're using an API key and have set up billing

If you're doing server-side geocoding (pre-caching results or similar), then your geocoding is per domain, and you're going to run out of requests pretty quickly. (i.e. in a similar vein to if you're doing places requests using the REST API like so: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=XXXX)

If you're using the javascript library, using the autocomplete functionality or PlacesService like so:

service = new google.maps.Geocoder();

then the limit (2,500 or 100,000 respectively), is per end-user, so your limit scales with your user base.

Community
  • 1
  • 1
Stephen Wright
  • 2,908
  • 4
  • 19
  • 28
  • Interesting. So are you suggesting that the 2,500 geocode API limit is per client? (ie: a user comes to my site and can perform 2,500 geocodes in a day?) – cantaffordavan Jan 01 '14 at 22:26
  • Yep, that's what i've come to understand. You can test this by looking at the API console, and running the REST call a few times manually, you will see your quota tally change. However, if you do the same request using the Geocoding service in the JS API, you won't see a change, because the limit is per-client, and thus doesn't affect your overall limit. – Stephen Wright Jan 02 '14 at 08:12
  • You've got the basic idea right, but the details wrong: there is no 2,500-per-end-user limit for client-side geocoding. – lambshaanxy Jan 06 '14 at 22:53
-3

According to the article you linked (under When to Use Server-Side Geocoding):

The 2,500 request limit is per IP address.

So - what exactly do you mean by limit? Limit for the hosting application, or for a client running it?

The statement above tells me that there is no limit for the "host"; without a key or enforceable referrer URLs, there is no (good) way for Google to determine from whence a geocoding request originates. That's kind of the beauty of REST, among other things.

It also tells me that even if they could enforce it, they haven't set a limit. This would likely be counter-productive to their business model.

klugerama
  • 3,312
  • 19
  • 25
  • This answer is incorrect. The 2,500 req/IP/day limit applies to server-side geocoding, not client-side geocoding. – lambshaanxy Jan 06 '14 at 22:50
  • Again, how would they determine the difference? Can you determine the difference, if it was your server serving geocoding results? Additionally, how is my answer different from yours? – klugerama Jan 06 '14 at 22:53
  • Oops, sorry, didn't parse the rest of your answer correctly! So yes, your conclusion is correct, even though the 2,500 request per IP limit is a red herring (it does not apply to client-side geocoding). Please make an edit to your answer so I can un-downvote you ;) – lambshaanxy Jan 06 '14 at 22:57
  • @klugerama By IP address. Your server is running on 1 IP address, your clients on many. Your client-side calls will be Jscript based and each client loads their own instance of the API. – user3308043 Aug 02 '14 at 22:40
  • @user3308043 Yes, that is exactly what I'm saying. The server-side application has no limit, since it doesn't make the actual API calls - each client does. – klugerama Aug 04 '14 at 20:58