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
NM AdminNM Admin 

How to fix the error message "OVER_QUERY_LIMIT".

Hello,

I have requirement to fetch the addresses using the lat,long. Also want to schedule the functionality i.e every half an hour wan to fetch the users current location(Lat,Long) and then addresses using google map APIs.
I have done with the funstionality but I'm not getting addresses(street,city,state,postal code etc..)

getting the below error:
"error_message" : "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_",

"status" : "OVER_QUERY_LIMIT" 
Is there any way to fix the error.

welcome to your suggestions!


Thanks,
Nilesh
bhanu_prakashbhanu_prakash
Hi NIM Admin
Mark as best answer, If it resloves !!
The geocoder has quota and rate limits. From experience, you can geocode ~10 locations without hitting the query limit (the actual number probably depends on server loading). The best solution is to delay when you get OVER_QUERY_LIMIT errors, then retry. 
check here for more info
https://stackoverflow.com/questions/14014074/google-maps-api-over-query-limit-per-second-limit

Mark as resloved if it helps :) :)
Thanks, 
Bhanu Prakash
visit ForceLearn.com ​  (https://www.forcelearn.com)
NM AdminNM Admin
Thanks Bhanu_Prakash,

I'm just fetching lat long from javascript and passing them to apex and using them doing callout to get the exact address. So I want to do this in the apex class/vf page controller.
Do we have any other way to achieve this..

Thanks,
NIlesh
bhanu_prakashbhanu_prakash
Yes, you need to write a controller to fetch data of geo points and need to write a schedule class to make them auto run in time of span 

Mark as resloved if it helps :) :)
Thanks, 
Bhanu Prakash
visit ForceLearn.com ​ (https://www.forcelearn.com)
NM AdminNM Admin
Thanks Bhau_Prakash,

I optimize the code by checking if the lat and long is already exist then don't make call out.
I have already scheduled my job for half an hour. But the thing is that LIMITS are getting exceeded while testing the functionality.

I'm fetching lat long from javascript and passing them to the controller and then making callout for getting addresses where I'm getting error message at the back end of the functionality. when the error comes it'll not fetching addresses.

Is this limits User specific?
Is this limit Org specific?

Need some more help. OR other solution if possible to optimize the code.


Thanks,
Nilesh