I have a map which calculates with this method of google directionsService.route, with that method a response is returned. I just want is to be able to get the time calculated by google.
var directionsDisplay = new google.maps.DirectionsRenderer();
var directionsService = new google.maps.DirectionsService();
var request = {
origin:{lat:latitudUsuario,lng:longitudUsuario},
destination: {lat:9.95,lng:-67.39},
travelMode: google.maps.DirectionsTravelMode['DRIVING'],
unitSystem: google.maps.DirectionsUnitSystem['METRIC'],
provideRouteAlternatives: true
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setMap(map);
directionsDisplay.setDirections(response);
}else{
alert("No existen rutas entre ambos puntos");
}
});
Try doing the following. Just below the call:
Add this code:
I leave a demo here: https://jsfiddle.net/Socramg/0po00agp/
More info here: https://developers.google.com/maps/documentation/directions/intro?hl=es