Durga Dutt
Durga Dutt

Reputation: 4113

Google Maps Api version 3

I am using google map api version 3 . Now i want to link markers with line, so that a path can be created between the markers. Any solution ?

Upvotes: 0

Views: 488

Answers (1)

Bhanu Prakash Pandey
Bhanu Prakash Pandey

Reputation: 3785

To create line between two markers use this

var Polyline_Coordinates = [
new google.maps.LatLng(42.357778,-71.061667), // your location lattitude and longitude
new google.maps.LatLng(40.716667,-74), 
new google.maps.LatLng(41.836944,-87.684444),
new google.maps.LatLng(34.05,-118.25) 
];
var Polyline_Path = new google.maps.Polyline({
path: Polyline_Coordinates,
strokeColor: "#000000",
// color of the outline of the polyline
strokeOpacity: 1.0,
// between 0.0 and 1.0
strokeWeight: 5
// The stroke width in pixels
});
Polyline_Path.setMap(map);

Upvotes: 2

Related Questions