I have requirement such that I need to draw a line between Sydney, Melbourne and Adelaide and the line between Sydney and Adelaide should be dark in color a
One option would be to create google.maps.Polyline
object per every line, below is provided the modified example from Simple Polylines page:
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 5,
center: {lat: -32.9340105, lng: 128.2698231},
mapTypeId: google.maps.MapTypeId.TERRAIN
});
var flightPlanCoordinates = [
{lat: -33.877024, lng: 151.227963},
{lat: -37.816567, lng: 144.961489},
{lat: -34.930054, lng: 138.593065}
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates.slice(0,2),
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2,
map: map
});
var flightPath2 = new google.maps.Polyline({
path: flightPlanCoordinates.slice(1,3),
geodesic: true,
strokeColor: '#FFCC00',
strokeOpacity: 1.0,
strokeWeight: 2,
map: map
});
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}