Google地图:DirectionService会返回OVER_QUERY_LIMIT响应 [英] Google maps: DirectionService returns OVER_QUERY_LIMIT response
问题描述
我使用google.maps.DirectionsService获取两点之间的路线。该代码在过去的8个月内运行。但是,从过去的几天,DirectionService路由调用正在返回OVER_QUERY_LIMIT响应状态。只有6组点,其中只有2或3个请求得到结果,其余都失败。代码与过去8个月保持一致。以下是供参考的代码片段:
var directionsService = new google.maps.DirectionsService();
var request = {
origin:originLatlng,//这是类型:google.maps.LatLng
destination:destLatlng,
travelMode:google.maps.DirectionsTravelMode.DRIVING,
provideRouteAlternatives:true
};
directionsService.route(request,function(result,status){
if(status == google.maps.DirectionsStatus.OK){
polyline = new google.maps.Polyline({
path:result.routes [0] .overview_path,
strokeColor:color1,
strokeOpacity:0.8,
strokeWeight:5,
geodesic:true
});
}
}
几乎6个这样的同步请求发给了方向服务,我不能在这些请求之间进行睡眠,因为它会增加我的应用程序GUI加载时间。
我尝试了相同的代码不同的网络也依然存在,仍然存在问题。
我绝对没有接近达到2500个每日要求限额。
这里可能是什么问题?租赁建议为此解决方案。
任何帮助将不胜感激。
预先致谢
> Satyapal
Google Map API有两种配额。您正在使用客户端配额,如果您请求的每分钟地理编码超过〜20(这是我观察到的),则会阻止您。
在此处查找详细信息:
https://developers.google.com/ maps / articles / geocodestrat#client
I am using google.maps.DirectionsService for getting the route between two points. This code was working from past 8 months. However, from past couple of days DirectionService route call is returning OVER_QUERY_LIMIT response status. There are only 6 set of points, out of which only 2 or 3 requests are getting the result, rest are failing. Code is unchanged from past 8 months. Below is the code snippet for reference:
var directionsService = new google.maps.DirectionsService();
var request = {
origin:originLatlng, //This is of type : google.maps.LatLng
destination:destLatlng,
travelMode: google.maps.DirectionsTravelMode.DRIVING,
provideRouteAlternatives: true
};
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
polyline = new google.maps.Polyline({
path: result.routes[0].overview_path,
strokeColor: color1,
strokeOpacity: 0.8,
strokeWeight: 5,
geodesic: true
});
}
}
Almost 6 such simultaneous requests are made to DirectionService. I cannot put sleep in between the requests because, it will increase my application GUI load time.
I have tried the same code from different networks also, still problem persists.
I definitely did not come anywhere close to reaching the 2,500 daily request limit.
What could be the problem here? Please suggest a solution for this.
Any help would be greatly appreciated.
Thanks in advance
Satyapal
There are 2 kind of quota for Google Map API. You are using client side quota which blocks you if you request more than ~20 ( thats my observation ) geocode per minute.
Look here for detailed information :
https://developers.google.com/maps/articles/geocodestrat#client
这篇关于Google地图:DirectionService会返回OVER_QUERY_LIMIT响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!