2011-02-01 80 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);