0
我有一個SPA,我需要能夠提供兩點之間的用戶指導。我希望這些說明的工作方式與他們目前在谷歌地圖的網絡版上的工作方式相同。 IE瀏覽器。 https://www.google.ca/maps/dir/在由谷歌網頁版主辦,當你要求的方向,它會給你最快的路線考慮交通......(見截圖)谷歌地圖api最快路線圍繞交通
目前,當我使用下面的代碼它只返回發出請求一條不考慮流量的單一路線。
var directionsService = this.get('directionsService');
var directionsDisplay = this.get('directionsDisplay');
directionsService.route({
origin: new google.maps.LatLng(this.get('currentLocation.lat'),this.get('currentLocation.lng')),
destination: new google.maps.LatLng(toAddress.lat,toAddress.lng),
travelMode: 'DRIVING',
provideRouteAlternatives: true
}, function(response, status) {
if (status === 'OK') {
directionsDisplay.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
有沒有人知道thr正確的方法來做到這一點?