【发布时间】:2018-07-07 10:22:25
【问题描述】:
这是我用来绘制单个路径的代码。请向我提供有用的详细信息,以便我找到不同的路径。
calculateAndDisplayRoute() {
var directionsService = new google.maps.DirectionsService;
var directionsDisplay = new google.maps.DirectionsRenderer;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: {lat: 41.85, lng: -87.65}
});
directionsDisplay.setMap(map);
directionsService.route({
origin: this.start,
destination: this.end,
travelMode: 'DRIVING'
}, function(response, status) {
if (status === 'OK') {
directionsDisplay.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
}
ionViewDidLoad() {
this.calculateAndDisplayRoute();
}
【问题讨论】:
标签: angular google-maps google-maps-api-3 ionic3