2011-02-01 78 views
0

我正在使用谷歌地图api版本3。现在我想用线连接标记,以便可以在标记之间创建路径。 任何解决方案?Google Maps Api版本3

回答

2

要在两个标记之间创建线 使用

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);