<< Return to Blog

Google Maps Geocoding Strategies and Quotas Explained

author Tom Allen, December 15th, 2015
blogpost

There seems to be a fair amount of confusion in developer-land about how best to take advantage of Google Maps geocoding quotas as evidenced by the number of tickets relating to this topic on StackOverflow. To be fair to developers, Google have not exactly covered themselves in glory by explaining this topic well, and indeed there have been a number of recent changes to quota rules and charging that were not well advertised by Google but which are important to now understand fully.

First, it's important to distinguish between client-side geocoding and server-side geocoding which I will explain separately as follows.

Client-side Geocoding

Client-side geocoding requests are made by JavaScript calls to google.maps.Geocoder which are executed inside the user’s web browser. There is no quota applied to client-side geocoding requests but (and it is a big BUT), they are rate limited. What this means is that the time taken to return each subsequent geocoding request will increase at an exponential rate. How slow does it get? Here’s how long each result takes:

Client Side Geocoding rate limiting

What does this mean for you? Client side geocoding is quick and there is no quota or rate limiting applied as long as you’re only done a few requests for each client - as shown in the chart, the first ~20 requests do not have rate limiting applied. For example, if you need to geolocate every visitor to your website and you have a million unique visitors per day, client side geocoding is a perfect solution. Each client side request performed in the web browser of each user will be fulfilled in a few ms by Google and you will never run into a quota limit so it is completely free for your business. Perfect!

When shouldn’t you use client side geocoding? Answer: when you have a large number of geocoding requests per client which need to be resolved in a short space of time. For example, when geocoding a large list of locations (i.e. greater than 100) uploaded by a visitor to your website. In this situation it would be better to use server side geocoding which will not be rate limited.

Server-side Geocoding

 Server-side geocoding requests are HTTP requests made on your web server to https://maps.googleapis.com/maps/api. In this case, there are no rate limits but there is a quota limit of 2,500 requests per day. This is applied in one of two ways – if you don’t use an API key for your requests (for example: http://maps.googleapis.com/maps/api/geocode/json?address=Estonia) then Google will apply a quota limit to the IP that you are using to make the requests. Yes, this does mean if you have a number of web servers with which you can round robin the requests then you could in theory perform 2,500 requests per day per server (but don’t blame me if the Google abuse team get wind of this and wield their mighty BanHammer).

Alternatively, if you use an API key to make the requests (for example: https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY) then you will be limited to 2,500 requests per day based on the API key used in your request. The good news is that if you wish, you can enable Billing for your Google account and permit additional requests to be made each day so this is no longer a hard limit.

In the bad old days (pre 2nd September 2015) there was no easy way for smaller companies to purchase additional server based geocoding requests beyond the daily 2,500 query limit. That is, unless you were a large corporation that ‘Google Customer Support’ (like Santa, the Easter Bunny and fairies in my garden, I stopped believing this entity existed a number of years ago) deigned to reply to support requests for enabling this service.

Other options

Finally, one alternate approach to geocoding is to use a service such as MapBox. MapBox (https://www.mapbox.com/developers/api/geocoding) permits up to 100,000 geocoding requests per day which as of the date of publication of this blog is the most permissive of any free geocoding service. However, there are a number of license restrictions; the two that are likely to be most restrictive for potential consumers of this service are the limitation on caching of results of 30 days and that the geocoding results must be displayed on a MapBox map. That is, you can’t (legally at least) mix and match MapBox geocoding results with a Google or Bing map display for example.

I hope that helps someone out there navigate the complexities of Google geocoding quotas and rate limits and saves a few hairs on a fellow web developers head.

If you have any further questions about this article, feel free to contact me at any time.

<< Return to Blog