Last active
April 21, 2016 16:34
-
-
Save AdrienVH/11289236 to your computer and use it in GitHub Desktop.
Utiliser Google Maps pour calculer un itinéraire entre deux adresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Pré-requis : charger la librairie Google Maps : | |
<script src="https://maps.googleapis.com/maps/api/js?key=...&sensor=false"></script> | |
*/ | |
// Adresses | |
var origin = '191 rue Saint-Jacques, Paris'; | |
var destination = '37 bd Romain Rolland, Montrouge'; | |
// Itinéraire | |
var directionsService = new google.maps.DirectionsService(); | |
directionsService.route({origin:origin, destination:destination, travelMode:google.maps.TravelMode.DRIVING}, function(result, status){ | |
if(status == google.maps.DirectionsStatus.OK) | |
{ | |
console.log(result); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment