Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created October 22, 2018 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/70a49edf0eea534c64ab754ca9eb1d33 to your computer and use it in GitHub Desktop.
Save fitomad/70a49edf0eea534c64ab754ca9eb1d33 to your computer and use it in GitHub Desktop.
directions.route(directionRequest, function(error, results) {
if(error)
{
console.log(error);
return;
}
var coordinates = Array();
var routeCounter = 0;
results.routes.forEach(function(route) {
route.path.forEach(function(step) {
step.forEach(function(coordinate) {
coordinates.push(coordinate);
});
});
// Dibuja la ruta en el mapa
drawRoute(coordinates, mapCustomColor[routeCounter], true);
/// Muestra un DIV con las instrucciones de la ruta
showRoutePlan(routeCounter, route.distance, route.expectedTravelTime, route.steps);
// Preparados para la siguiente ruta
coordinates = Array();
routeCounter++;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment