gpt4 book ai didi

javascript - Google Maps API - 折线捕捉到道路限制

转载 作者:行者123 更新时间:2023-11-28 08:46:24 24 4
gpt4 key购买 nike

我正在构建几条与道路对齐的折线。下面是其中 2 个的代码。超过 15 条折线捕捉到道路,出现以下错误:“方向请求失败:OVER_QUERY_LIMIT”。

因此,我想找到一个解决方案。其中之一就是将所有这些信息放入我的计算机的缓存中,因此我从 Google map 中获得的唯一内容就是 map 。这可能吗?

您还知道其他一些解决方案吗?

//Circuit CHL1C1

CHL1C1 = [
new google.maps.LatLng(-22.91401,-68.192237),
new google.maps.LatLng(-23.226361,-67.064938)
];

var traceCHL1C1 = new google.maps.Polyline({
path: CHL1C1,
strokeColor: "red",
strokeOpacity: 1.0,
strokeWeight: 4
});

var serviceCHL1C1 = new google.maps.DirectionsService(),traceCHL1C1,snap_pathCHL1C1=[];
traceCHL1C1.setMap(map);
for(j=0;j<CHL1C1.length-1;j++){
serviceCHL1C1.route({origin: CHL1C1[j],destination: CHL1C1[j+1],travelMode: google.maps.DirectionsTravelMode.DRIVING},function(result, status) {
if(status == google.maps.DirectionsStatus.OK) {
snap_pathCHL1C1 = snap_pathCHL1C1.concat(result.routes[0].overview_path);
traceCHL1C1.setPath(snap_pathCHL1C1);
} else alert("Directions request failed: "+status);
});
}




//Circuit CHL1C2

CHL1C2 = [
new google.maps.LatLng(-22.898988,-68.198154),
new google.maps.LatLng(-22.337195,-68.016747),
new google.maps.LatLng(-22.443062,-68.899408)
];

var traceCHL1C2 = new google.maps.Polyline({
path: CHL1C2,
strokeColor: "green",
strokeOpacity: 1.0,
strokeWeight: 4
});

var serviceCHL1C2 = new google.maps.DirectionsService(),traceCHL1C2,snap_pathCHL1C2=[];
traceCHL1C2.setMap(map);
for(j=0;j<CHL1C2.length-1;j++){
serviceCHL1C2.route({origin: CHL1C2[j],destination: CHL1C2[j+1],travelMode: google.maps.DirectionsTravelMode.DRIVING},function(result, status) {
if(status == google.maps.DirectionsStatus.OK) {
snap_pathCHL1C2 = snap_pathCHL1C2.concat(result.routes[0].overview_path);
traceCHL1C2.setPath(snap_pathCHL1C2);
} else alert("Directions request failed: "+status);
});
}

最佳答案

如果我错了,请纠正我,但免费 API 最多有 8 个航路点。

关于javascript - Google Maps API - 折线捕捉到道路限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19732111/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com