codice:
var routes = [{origin:..., destination:...}, {origin:..., destination:...}, {origin:..., destination:..}];
for(i=0;i<routes.length;i++){
var request = {
origin:routes[i].origin,
destination:routes[i].destination,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
var directionsDisplay = new google.maps.DirectionsRenderer();
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
Nel codice suggerito, nel link da te postato, c'è un errore, non prenderlo in considerazione.