I'm exploring the Google map API v3. it there a way to show at the same time different ways to achieve from point A to point B? bus, walking car?
I did something like this but, obvious, it overrides the 1st i write. any help?
function calcRoute() {
// var start = document.getElementById('start').value;
// var end = document.getElementById('end').value;
var request = {
origin: "Avenida da Liberdade, Lisboa",
destination: "Campo Grande, Lisboa",
travelMode: google.maps.TravelMode.TRANSIT
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
directionsDisplay.setMap(map);
}
});
var request2 = {
origin: "Avenida da Liberdade, Lisboa",
destination: "Campo Grande, Lisboa",
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request2, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
directionsDisplay.setMap(map);
}
});
}
<input type="button" title="Transportes" onclick="calcRoute();"/>