【问题标题】:OVER_QUERY_LIMIT error for Google Maps after 2500 requests2500 次请求后 Google 地图出现 OVER_QUERY_LIMIT 错误
【发布时间】:2017-02-01 08:41:29
【问题描述】:

我们的应用程序在早上可以正常运行,可能要等到配额用完,但在那之后它就无法在当天运行。我们面临以下错误。

由于我们使用的是高级服务,并为地图版本 3 注册了客户端,所以一切看起来都很好。延迟或超时不应该起作用,因为它似乎在某个循环中进行。

代码如下:

_resolveInitialLocation: function () {
                     var url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + this._currentLatitude + "," + this._currentLongitude;


            if ( this._customerAddress ) {

                url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + this._customerAddress;
            }

            return xhr(url, {
                headers: { "X-Requested-With": null },
                handleAs: "json"
            }).then( lang.hitch(this, function ( place ) {
                // this._search( place.results[0] );
                this._place = place.results[0];

                if ( dom.byId("pac-input") ) {
                    dom.byId("pac-input").value = this._place.formatted_address;
                }

                this._currentLatitude = this._place.geometry.location.lat;
                this._currentLongitude = this._place.geometry.location.lng;
            }));
        },

        _initGoogleMaps: function ( /* Boolean */ preSearch ) {
            // summary
            //      this function will initialize google maps api
            // tags
            //      branch locator, google maps, maps

            if ( this._place ) {
                this._currentLatitude = typeof this._place.geometry.location.lat === "function" ? this._place.geometry.location.lat() : this._place.geometry.location.lat;
                this._currentLongitude = typeof this._place.geometry.location.lng === "function" ? this._place.geometry.location.lng() : this._place.geometry.location.lng;
            }

            var initialLocation = new 

google.maps.LatLng(this._currentLatitude, this._currentLongitude);
               .
..
..
                };

请查看我们面临的以下错误。我们正在使用 Dojo java 脚本库。

来自 googleapis.com 的 http 请求获取错误:

https://maps.googleapis.com/maps/api/geocode/json?latlng=22.280297,114.159514 
{
"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=_", 
"results" : [],
"status" : "OVER_QUERY_LIMIT"
}

提前致谢。

【问题讨论】:

    标签: javascript dojo google-geocoder


    【解决方案1】:

    如果您是具有高级帐户的地图版本 3 的注册客户,则很可能该 URL 缺少“API KEY”参数。

    如果您在 Google Maps APIs 高级计划下使用 API,您 有两个身份验证选项:使用在 Google 中设置的 API 密钥 购买时为您创建的 Maps API 高级计划项目 高级计划,或使用您的客户端 ID 而不是 API 密钥。 Source.

    【讨论】:

    • 谢谢 GibboK,这是我们要访问的 URL。maps.googleapis.com/maps/api/… 在 URL 中,我只用 abcd 更改了公司名称。如果有任何问题,请提供帮助。
    • @SandipMante 感谢您的留言,如果您认为我的回答对您有帮助,请不要忘记使用图标箭头向上或在左侧打勾点赞或接受。谢谢,编码愉快!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多