ciao a tutti, a questo articolo http://www.html.it/articoli/google-m...on-directions/ ho trovato lo script per calcolare il percorso in google maps tra 2 luoghi. ora quello che però vorrei fare io è poter inserire anche destinazioni intermedie. ho cercato in giro su internet ma non trovo niente. qui sotto trovate lo script di cui vi ho parlato prima, mi vanno bene anche indicazioni su guide da usare per riuscire a inserire ste benedette tappe intermedie.
codice:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps API v3: Directions</title>
<style type="text/css">
html, body { margin:0; padding:0; width:100%; height:100%; }
body { background:#FFFFFF; color:#000000; font-family:Arial, Helvetica, sans-serif; font-size:12px; line-height:150%; text-align:center;}
#map { width:100%; height:95%; }
input { width:250px; }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
calcRoute();
directionsDisplay = new google.maps.DirectionsRenderer();
var myOptions = {
zoom:7,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map"), myOptions);
directionsDisplay.setMap(map);
document.getElementById("submit").onclick = function() {
calcRoute();
}
}
function calcRoute() {
var partenza = document.getElementById("partenza").value;
var arrivo = document.getElementById("arrivo").value;
var request = {
origin:partenza,
destination:arrivo,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
window.onload = initialize;
</script>
</head>
<body>
<div>
Partenza:
<input type="text" id="partenza" value="Via del Portonaccio - Roma">
Arrivo:
<input type="text" id="arrivo" value="Via Zamboni - Bologna">
<input id="submit" type="button" value="trova percorso sulla mappa">
</div>
<div id="map"></div>
</body>
</html>