I have a question, I have a function in javascript, but apparently it does not receive the coordinates correctly, when you put the mouse over the link that the function calls, you can see that if the coordinates go. I enclose the code of the function and the error generated
function VerRuta(origen, destino){
var ori = { lat: 0.0, lng: 0.0 };
var dest = { lat: 0.0, lng: 0.0 };
///Para crear una ruta
////alert("origen: " + origen.lat + " " + origen.lng + " Destino: " + destino.lat + " " + destino.lng);
var map = new google.maps.Map(document.getElementById('map-geolocation1'), {
center: { lat: -0.248207, lng: -78.480393 },
zoom: 8
});
var directionsDisplay = new google.maps.DirectionsRenderer({
map: map
});
//// Asignar el destinatario y el origen, ademas del modo de viaje.
alert(ori.lat);
var request = {
destination: destino,
origin: origen,
travelMode: 'DRIVING'
};
//// Pasamos las direcciones al servicio de direcciones.
var directionsService = new google.maps.DirectionsService();
directionsService.route(request, function (response, status) {
if (status == 'OK') {
// Mostramos la ruta en el mapa.
directionsDisplay.setDirections(response);
} else {
alert(status);
}
});
}
and this is the error it throws:
"InvalidValueError: in property origin: not to string; and not to LatLng or LatLngLiteral: not to Object; and not to Object"
Apparently it does not detect a valid latitude and longitude.