捕捉道路谷歌API API v3的限制 [英] Limitations of snap to road google api v3
问题描述
我有一些gps locatiwaon点,我想绘制路径。我使用不遵循道路的多段线绘制方式。我想做 ,这样我就可以改进路径。
我把这个代码以捕捉到保存在数组snap_path_points中的位置的道路
(限制),下面是代码
var service = new google.maps.DirectionsService(),poly ,snap_path = [];
poly = new google.maps.Polyline({map:map});
for(j = 0; j service.route({
origin:snap_path_points [j],
destination:snap_path_points [j +1],
travelMode:google.maps.DirectionsTravelMode.DRIVING
},function(result,status){
if(status == google.maps.DirectionsStatus.OK){
snap_path = snap_path.concat(result.routes [0] .overview_path);
poly.setPath(snap_path);
}
});
}
我将我的位置分为8个批次,并尝试相同(即如果24点使用3 for循环),但我越来越 OVER_QUERY_LIMIT
。
我想知道它如何使用事件侦听器 here 。
OVER_QUERY_LIMIT表示网页在允许的时间段内发送了太多请求
。
无论如何,绘制超过8点的道路完全对齐。 解决方案
问题不在于你发送了太多分你在给定的时间段内提出了太多要求。 api to api api表示:
标准API的用户:
每天2,500个免费请求和每秒10个请求
因此,如果您发送的请求超过上述限制,则是原因为什么你会得到这个错误。
Update: I have some gps locatiwaon points and i want to draw the path.I the way draw using polylines which dont follow road.I want to do "snap to road",so that i can improve the way path.
I referred this code to snap to road for the locations saved in array "snap_path_points"
I am getting path only for first 8 calls (limitation),below is code
var service = new google.maps.DirectionsService(), poly,snap_path=[];
poly = new google.maps.Polyline({ map: map });
for(j=0;j<snap_path_points.length-1;j++){
service.route({
origin: snap_path_points[j],
destination: snap_path_points[j+1],
travelMode: google.maps.DirectionsTravelMode.DRIVING
}, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
snap_path = snap_path.concat(result.routes[0].overview_path);
poly.setPath(snap_path);
}
});
}
I divided my locations to batches of 8 and tried the same (i.e if 24 points use 3 for loops ) but i am getting OVER_QUERY_LIMIT
.
i wonder how its working with event listener here.
OVER_QUERY_LIMIT indicates the webpage has sent too many requests within the allowed time period.
Is there anyway to plot complete snap to road path with more than 8 points.
The problem is not that you sent too many points it is that you made too many request in the given time period. The snap to roads api states that:
Users of the standard API:
2,500 free requests per day and 10 requests per second
So if you sent more request than the limit described above, it is the reason why you are getting that error.
这篇关于捕捉道路谷歌API API v3的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!