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正确的方法来做到这一点?