Limits for Web & Mobile app based on google maps - google-maps

I have read a lot, 1 but I still think I didn't find clear answers about the following questions:
1) A user of my web or mobile app uses an input in order to find Lat, Long of an address (I am using Javascript). Does this request represented by user's client IP or from my Server's IP?
I am asking because I want to ensure that this is a client side request in order to no overcome Google's 2,500 requests per IP.
2) Then, once I have the lat,long in my database I can draw the google map based on an array of lat, long which my user had store previously. Is this a request from my server's IP or user's IP?

Since the geocoding requests are going directly from the user's machine to Google, you are using what Google calls "client-side geocoding" which falls under slightly different licensing agreements than the 2,500/IP API limits.
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. Geocoding quotas and rate limits drive the strategies outlined in this article.
When running client-side geocode requests at periodic intervals, such as on a mobile app, your requests may be subject to blocking if all of your users are making requests at the same time (e.g. the same second of every minute). To avoid this, consider one of the following:
Use a caching strategy.
Introduce random intervals to your requests (jitter). Ensure requests are random across your entire userbase.
If developing for Android, use an inexact repeating alarm.
If developing for Android, select an appropriate location strategy.
In Google Maps API for Business, quotas are tied to client IDs, which provide much higher quotas. To learn more about Maps API for Business quotas and error handling, we recommend reviewing our article, Usage Limits for Google Maps API Web Services. If you're still running into quota limits using the Google Maps API for Business, file a support request here: http://www.google.com/enterprise/portal/.

Related

Google Javascript API Geocoding Limits

What are the limits for client side geocoding with Google Maps JavaScript API v3?
My research:
Google Maps PHP API has a limit of 2500 geocode requests per day (https://developers.google.com/maps/documentation/geocoding/#Limits)
Google Maps Javascript API v3 has a limit of 25000 map loads per day (https://developers.google.com/maps/documentation/javascript/usage)
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)
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:
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).
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.
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
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.
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.
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.

Storing Vs Calling Google Places API

My application queries Google Geocoding API once per user.
It stores their lat lon for analysis later.
I am considering a feature which calls Google Places API, and shows the user some "Places"
near them, on a map.
I do not want to store nearby Google Places. There is considerable overhead in this process.
Many people, on message boards, stress the importance of not bombarding the Places API from within my application. However, Google Places API allows a huge volume of daily traffic, much higher than Maps API and much higher than my website will use.
Can anyone definitively settle this?
The only possible reason to stress reducing the number of calls to the Places API is if you may be in danger of exceeding the stated quota limitsdev-guide (currently set at 100,000 for licensed sites). If you are confident that you will not approach or exceed the limit, then your assessment is correct. The added overhead associated with attempting to store results as a way to avoid similar Places API requests is not worth the added complexity. Simply call the Places API, process the results, and then place them on your Google Map to display to your user(s).

Geocoding API exceeds rate limit

I am using the Geocoding API for querying the location coordinates for a set of 100K users. However, because of rate limit, I am unable to fire more than 2500 requests per day. I need unrestricted access for the purpose of my study. This is for a project in my university. Can someone guide me in the right direction?
Per the Usage Limits section of the terms of service, even commercial users of the Google Geocoding API do not have unrestricted use:
Users of the standard API [are allowed] 2,500 free requests per day, calculated as the sum of client-side and server-side queries. ... Premium Plan customers: [receive a] shared daily free quota of 100,000 requests per 24 hours; additional requests applied against the annual purchase of Maps APIs Credits.
50* server-side requests per second. ... These limits are enforced to prevent abuse and/or repurposing of the Google Maps Geocoding API, and may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the per-day limit or otherwise abuse the service, the Google Maps Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Google Maps Geocoding API may be blocked.
You may want to review the Geocoding Strategies documentation from Google and/or rethink your implementation approach. Does the geocoding need to be dynamic, or is it from a preexisting set of data? Are you obligated to use the Google Maps Geocoding API, or could you use another service?
It's worth noting that most geocoding services will have a similar limit, and if they don't, hitting them with a run of 100,000 or more requests is generally recognized as being poor practice unless a prior arrangement has been made. You may want to consider using another geocoder service, or hosting your own geocoder (e.g. TwoFishes), to get around these limits.

Bypass Google Geocoding API IP Rate Limits

We are a division of a large corporation and are running into a MAJOR problem with the Google maps and geocoding API. The problem is that all 70 divisions of our corporation are behind the same IP address. So a customer service agent in India would appear to be coming from the same IP address as a developer in Cleveland, OH who would appear to be coming from the same IP address as a division president in western Europe. With over 130,000 employees, we routinely get blocked for exceeding the IP rate limit.
Aside from individuals just browsing to websites that happen to be using Google maps with client-side geocoding requests, any division that attempts to do batch geocoding or provides their own application for showing maps will all contribute to the same limit! We actually use our own Where To Buy service internally, which is publicly available, (http://www.ridgid.com/Tools/Where-To-Buy/), to give customers information about local distributors.
While we are not running into an API limit (at least not yet, and when we do we can always buy the enterprise license), we are running into the IP rate limit and currently have no workaround. We are already following best practices in terms of caching up geocoding results and reducing wasteful calls. Thankfully this isn't a problem for our customers as they are not on the same IP as users within our corporation.
The question is whether there is ANY way we can get an exception from Google to our specific IP address to improve the IP-based limitations given our setup? This is really a question for Google. Thanks for your help!
A division of a large corporation with tens of thousands of employees should have an enterprise licence.
I don't think there's a limit associated with IP if you are using the client-side geocoding as described here:
https://developers.google.com/maps/articles/geocodestrat
Server-side geocoding through the Geocoding Web Service has a quota
of 2,500 requests per IP per day, so all requests in one day count
against the quota. In addition, the Web Service is rate-limited, so
that requests that come in too quickly result in blocking.
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.
A "map session" means every time the Javascript Map API is loaded. However there might be a limit on that as well, whether or not it's associated with IP / domain / sub-domain / URL still needs further clarification.
And the "rate limited" on client side doesn't mean there is a daily quota or something, I had tested this method, on a single day, it can geocode more than 2500 addresses. You will have to think and test how the "rate limit" works, my observation is it let you burst to around 10 addresses in no time, then limit you to a rate of around 1 geocode per second for the next 150 request, further request from the same "session" would take exponentially longer time.
One possiblity is to use a batch of reverse geocode instead of a single request. Google allows up to 24 waypoints in a single direction request. Instead of sending a single reverse geocode you can wait until you have 24 reverse geocode accumulated in a batch. Or you can use Yahoo map like in this answer: Issue in displaying static Google maps.
I wondering if there is a lot of overlap in the requests, like everyone keeps looking up that same 50 locations? You write a caching proxy that makes requests to a internal database first then requests from Google when the results arn't found. This could be done at the software level changing the GeoCode call to a InternalGeoCode or maybe at the network level and catch all the requests to the Google Geocode servers and redirect them? I'm not 100% how hard this would be to implement or if it would help maybe the requests are all unique.
If you are doing forward geocoding only, I suggest trying out GeocodeFarm. I just got an email from them the other day saying they would start releasing "reverse" geocoding soon too and that they are still working out the kinks. Maybe it would help you since they have no request rate limits in place and the only limit is your daily 2,500 limit, same as google... IDK. Just a suggestion..
http://www.geocodefarm.com == the link
The limit in standard license is in 50 to 100 QPS (Queries per second) limit depending upon the service (i.e. Elevation service has a 50 QPS limit, Geocoding has a 100 QPS limit).
Despite you may have a higher quota you cannot perform more than 50 requests per second otherwise the server will block your IP for about 2 hours (based on my experience). The solution is to cache the requests and perform them on a scheduled basis and not upon occurrence.

What usage limits apply to the Google Maps API?

Google's usage guidelines state:
Web sites and applications using each of the Maps API may at no cost generate up to 25,000 map loads per day for each API
So if I have two sites on a single web server, do they share the limit of 25,000 map loads, or does each site have its own limit of 25,000 map loads?
Did you read the part when the query limit is exceeded? The Api simply doesn't compute a query and Google isn't sending a bill to you. You have to apply to the paid program yourself. I want to say you can show your user a brief explanation when that happens or redirect them to another site. Anyway it's written web sites not server so my opionion is you don't have to worry about this.
The limit is per API key not per website. But you have to "exceeded the limits for more than 90 consecutive days". Also "Non-profits and applications deemed in the public interest are not subject to these usage limits".
See the FAQ: http://code.google.com/apis/maps/faq.html#usagelimits