2500次请求后,Google地图的OVER_QUERY_LIMIT错误

时间:2017-02-01 08:41:29

标签: javascript dojo google-geocoder

我们的应用程序在早上完美运行,可能会直到配额结束但在此之后它永远不会在当天工作。我们面临以下错误。

由于我们正在使用高级服务和地图版本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 script lib。

来自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"
}

提前致谢。

1 个答案:

答案 0 :(得分:1)

如果您是使用Premium帐户的地图版本3的注册客户端,则很可能该URL缺少“API KEY”的参数。

  

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

相关问题