Exceeded usage limits for Geocoding API

浪尽此生 提交于 2019-12-14 00:18:54

问题


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


回答1:


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




回答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 .




回答3:


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




回答4:


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 #




回答5:


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'};


来源:https://stackoverflow.com/questions/28962765/exceeded-usage-limits-for-geocoding-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!