function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sornasorna 

Strange issue in Google Geocoding

Hi,

 

In my apex class, I am sending an address through httprequest to get the latitude & longitude values for those address.

 

This is working fine in my evening hours(i.e after 4pm IST). But the webservice is returning G_GEO_TOO_MANY_PARAMETERS error, if I try to geocode in morning hours(i.e before 4pm IST).

 

Usually this errorcode will be returned if we exceeded the Google Geocoding limits of 15000 per IP per day or if we frequently hits the geocoding service.

 

But in my case, none of these is happenning and I have also tried in various sandboxes/dev orgs and from various IP addresses. But getting the same result.

 

This looks very strange. So, if we use the free service of Google Geocoding, is there any restrictions that we can use it only between specific time intervals?

 

Please help me out in this...
sornasorna

I am providing some more additional informations along with the code.

I have written a trigger which will be fired if a contact's address is updated.

Inside the trigger, the updated address of the contact will be constructed as a string in following format:

 

street+' '+city+' '+state+' 'zipcode

 

And this string is passed into a future annotated method, which will do the webservice callout through http request:

 

httpRequest.setEndpoint('http://maps.google.com/maps/geo?output=csv&sensor=false&q='+sampleaddress); 

httpRequest.setMethod('GET');
httpResponse = myHttp.send(httpRequest); 

 

this response contains the lat lng values.

 

From 4 pm IST to 11 pm IST, it is working fine but from 11 pm to 4 pm, it is returning G_GEO_TOO_MANY_QUERIES status code.

But, during the same interval(11 pm to 4 pm), If I hit the geocoding by entering the following in the address bar of IE, I am not getting G_GEO_TOO_MANY_QUERIES status code:

 

http://maps.google.com/maps/geo?output=csv&sensor=false&q='+sampleaddress

 

So, that means there is no problem with google geocoding but the problem occurs when geocoding is done in salesforce for a particular time interval.

 

Pls help me out in this....

sfdcfoxsfdcfox

You need to contact Google about getting an "API Key". Please note that Google does enforce a per-day limit on geocodes one per API Key without their consent. Please read the documentation on the link I've provided.

sornasorna

Yeah...there is a limit on geocoding. It is 15000 per IP per day. We will recieve this G_Geo_Too_many_Queries status if we exceed this 15000 limit or  if we hit geocoding very frequently. But in my case, none of these is happenning. 

Thats why, I could not figure out the cause for this.

mshelmanmshelman

We too are now running into this error with Google geocoding from Apex.  Apparently, the geocoding formerly worked but now returns "620 - Too many queries" for all requests.  There's no obvious reason for it - we get the 620 response even with a single request which is the only request for 24 hours.  Could it be that the total requests from Salesforce are totalling more than 15000 or is Google simply blocking these kind of requests from Apex.  It happens both in UE production and sandbox.

 

Mike

Dataville1Dataville1
I'm assuming its because google only allows 15k requests in 24hrs from a specific IP for geocoding, and as Salesforce has potentially 1000s of customers on one IP so we're all sharing the same 15k max requests... so its going to max out almost immediatly.
thunksalotthunksalot
Wow, the fact that Google limits the queries on an IP basis and we are all sharing the same IP seems like a big problem.  Anybody know a work-around?
Dataville1Dataville1

The ONLY way to get round it is to make the request from a different IP Address (ie server). But its tricky!... the only way I can think is if you have your own corporate website call that to do the request from there.