Skip to content

Instantly share code, notes, and snippets.

@phsantiago
Last active March 1, 2016 23:44
Show Gist options
  • Save phsantiago/7c2d940d916c962b0315 to your computer and use it in GitHub Desktop.
Save phsantiago/7c2d940d916c962b0315 to your computer and use it in GitHub Desktop.
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer();
directionsDisplay.setMap(map);
var request = {
origin: lojas[0].location,
destination: lojas[1].location,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function (result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
directionsDisplay.setOptions({ suppressMarkers: true });
} else {
alert('error');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment