0
我試着重新創建,我使用所有的geopoints保存在我的數據庫的路徑,我想使用方向Rederer這樣做如何從overviewpath重新創建路線?
function addOldRoute(){
var waypts =[];
for (var int = 0; int < elems.length; int++) {
if(int !=0 && int!=elems.lenght-1){
waypts.push(getWaypoint(elems[int]));
}
}
var request = {
origin: new google.maps.LatLng(elems[0].latLng.lat(),elems[0].latLng.lng()),
destination: new google.maps.LatLng(elems[elems.length-1].latLng.lat(),elems[elems.length-1].latLng.lng()),
waypoints: waypts,
optimizeWaypoints: true,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function(result, status) {
if (status === google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
addPontos();
if (directionsDisplay.getMap() == null) {
directionsDisplay.setMap(mapAddRota);
}
}
});
}
function getWaypoint(elem){
return {
location:new google.maps.LatLng(elem.latLng.lat(), elem.latLng.lng()),
stopover:true
};
}
路由不,我得到一條消息,告訴我該最大wypoints超過