9

When accessing the below link: http://maps.googleapis.com/maps/api/geocode/json

I get the response:

{
   "error_message" : "You have exceeded your daily request quota for this API.",
   "results" : [],
   "status" : "OVER_QUERY_LIMIT"
}

There are only two APIs listed in the Google Developers Console - both report they are under their usage limits.

Is the geocode service included in either of these and if not is there a way to check the useage or pay to upgrade?

Maps API v3 # of requests Daily quota: 25k 28-day total: 2.37k

Static Maps API # of requests Daily quota: 25k 28-day total: 45.21k

Thanks in advance, Jon

Jon
  • 610
  • 2
  • 6
  • 13
  • 4
    Jon, if you are geocoding an address on the server side then the quota is 2500 requests/day. Are you geocoding server side, or client-side? I also hit this when I started with the Maps API V3, so I limited server side requests to the bare minimum and went client side as much as possible. also, are you including your api key in that url request, i.e. `&key=` ? – luke_mclachlan Mar 10 '15 at 11:44
  • Hi Luke - Yes, server-side and we cache the results. I was under the impression from another discussion that passing the api key was only needed for business accounts? – Jon Mar 10 '15 at 12:02
  • well i would try to eliminate any possibility. so i would type the request you're trying to make in the url bar, with and without the key, and see the response that you get. I'd also setup a new key and test with that one. another thing, are you maybe sending too many requests per second, because I know that google has a limit for that also? – luke_mclachlan Mar 10 '15 at 12:16
  • The key allows google to separate your requests from those of all the other sites on your shared server... (guess, you are using a shared server) – geocodezip Mar 10 '15 at 13:11
  • Are you accessing via a mobile browser? [Relevant question](http://stackoverflow.com/questions/14648200/google-static-map-displays-on-computer-but-not-on-mobile/14651310#14651310) – Andrew Leach Mar 10 '15 at 14:20
  • Hope it might help our developers http://stackoverflow.com/a/35063377/3840428 – Nagarjun Jan 28 '16 at 13:55

5 Answers5

24

Thanks to luke_mclachlan for the fix.

The URL was missing the parameter for the API key e.g.

https://maps.googleapis.com/maps/api/geocode/json?key=AbCdEfGhIjKlMnOpQrStUvWxYz&address=Dallas&sensor=true

What was throwing us was that without the API key there seems to be a lower limit that we were hitting by about 2:30am which didn't appear in testing.

The API key used can be found in the Google Developers Console here: https://console.developers.google.com/project

Click your project name Then look on the left hand menu and click "Credentials" under "APIs & auth" The value "API KEY" is the same for all usages

Jon

Jon
  • 610
  • 2
  • 6
  • 13
  • 1
    Thanks, this put me on the right track. However, it only worked for me when I put "&key=[API_KEY]" at the end of the string (source: https://developers.google.com/maps/documentation/geocoding/intro?hl=de) – Pingui Sep 03 '15 at 19:40
2

Parameter Key was missing.

https://maps.googleapis.com/maps/api/geocode/json?key=AbCdEfGhIjKlMnOpQrStUvWxYz&address=Dallas&sensor=true

key=AbCdEfGhIjKlMnOpQrStUvWxYz needs to be added .

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
priya
  • 21
  • 1
0

Not sure this is just related to the key query param missing. I see the same misleading API response when the &language=GB&region=UK was replaced by my app to instead query &language=GB®ion=uk. This is server based querying and the API access is authorised by API credentials stored with Google. The API returns:

"You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console"

Response seems to be the generic repsonse for a malformed query string than anything else, key parameter or otherwise.

Valid: https://maps.googleapis.com/maps/api/geocode/json?address=St%20Georges%20Avenue%20Sheerness%20ME12%201QU%20United%20Kingdom&language=GB&region=uk

Invalid: https://maps.googleapis.com/maps/api/geocode/json?address=St%20Georges%20Avenue%20Sheerness%20ME12%201QU%20United%20Kingdom&language=GBfoobar=uk

chopstik
  • 363
  • 2
  • 10
  • Looks like "&reg" is being encoded as "®" - try encoding the ampersand as & in that string. Your invalid string looks like it's missing an ampersand before "foobar=uk" – Jon Aug 09 '18 at 12:37
0

In my case, I was passing '#' char in ?address=#202, Hollywood park. i removed # from the address api. May be google's api is breaking on spacial character especially #

Mukesh Kumar
  • 333
  • 1
  • 5
  • 20
0
ini_set('allow_url_fopen', 'on');
//ini_set('allow_url_fopen', '1');
$address=urlencode($address);


$address = str_replace(" ", "+", $address);
$json = file_get_contents("https://maps.google.com/maps/api/geocode/json?key=AIzaSyDq-gfJDoytQE6gj0iHXEy4IZQhgLS70-8&address=$address&sensor=true");
$json = json_decode($json);

$lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$lng = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Shiv Ram
  • 5
  • 2
  • While this code block may answer the question, it would be best if you could provide a little explanation for why it does so. Please [edit] your answer to include such a description. – Artjom B. Oct 12 '18 at 21:10