i want to draw multiple polylines on the google map, for multiple routes.
for this i am using google.maps.DirectionsService
function drawPolyline(source,destination,waypoints){
// show route between the points
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer(
{
suppressMarkers: true,
suppressInfoWindows: true
});
directionsDisplay.setMap(map);
var request = {
origin:source,
destination:destination,
waypoints:waypoints,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status)
{
if (status == google.maps.DirectionsStatus.OK)
{
directionsDisplay.setDirections(response);
}
});
}
but when i call this method multiple times, only last polyline is appearing. and i want different colors for different polylines.