sunny7006
unread,Oct 22, 2010, 8:43:11 AM10/22/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Maps JavaScript API v3
I want to show multiple routes on the map with different colors for
the routes to be able to make it easier to identify them.
Following is the code i have been using. Can some on please show me
how can I change the route colors.
var map;
var Decatur = new google.maps.LatLng(39.83, -88.87);
var MY_MAPTYPE_ID = 'Tracking';
function initialize() {
var rendererOptions =
{
map: map
};
var directionsDisplay = new
google.maps.DirectionsRenderer(rendererOptions);
var mapOptions = {
zoom: 6,
center: Decatur,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, MY_MAPTYPE_ID]
},
mapTypeId: MY_MAPTYPE_ID
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
function renderDirections(result)
{ var directionsRenderer = new google.maps.DirectionsRenderer;
directionsRenderer.setMap(map);
directionsRenderer.setDirections(result);
directionsRenderer.setOptions({ suppressMarkers: true } );
}
var directionsService = new google.maps.DirectionsService;
function requestDirections (start, mid, end)
{ directionsService.route
(
{
origin: start,
destination: end,
waypoints: mid,
travelMode: google.maps.DirectionsTravelMode.DRIVING
},
function (result)
{
renderDirections(result);
}
);
}
requestDirections('(42.9181, -87.9267)',[ ], 'Florence,
KY');
requestDirections('Stillwater, OK', [{location: "Dallas, TX"},
{location: "Austin, TX"}], 'Houston, TX');