-2
I’m building a website (html/php/javascript/css) with integration with google maps using the Javascript API.
function initMap() {
var directionsService = new google.maps.DirectionsService;
var directionsDisplay = new google.maps.DirectionsRenderer;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: cidade
});
directionsDisplay.setMap(map);
//Painel texto
calculateAndDisplayRoute(directionsService, directionsDisplay);
directionsDisplay.setPanel(document.getElementById('right-panel'));
}
function calculateAndDisplayRoute(directionsService, directionsDisplay) {
directionsService.route({
origin: document.getElementById('endOrigem').value,
destination: document.getElementById('endDest').value,
waypoints: waypoints,
travelMode: google.maps.TravelMode.DRIVING
}, function(response, status) {
if (status === google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
window.alert('ERRO!!');
}
});
}
So far everything is working perfectly. The route opens in a div on the site itself.
What I need is, when accessing the site with Android/iOS this Route is open in the user’s Maps, or at least ask the user if he wants to open in brownser or Maps.
I do not know how to pass these parameters (origin, destination and waypoints) at the url?!
Leonardo, this on android neh? But and to redirect via html or java, have how? from the browser call google maps..
– Juliano