我有一个数组,我想其值传递到一个路径绘制多边形将值传递给google.maps.LatLng
var coords = new Array("25.1, 66", "25.5, 65", "21.3, 67");
无论坐标数,如何可以通过这个图案“X, Y”定义为在阵列中上面google.maps.LatLng
var triangleCoords = [
new google.maps.LatLng(coords[0]),
new google.maps.LatLng(coords[1]),
new google.maps.LatLng(coords[2]),
];
// Construct the polygon
// Note that we don't specify an array or arrays, but instead just
// a simple array of LatLngs in the paths property
draw = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.35
});
'LatLng'总是需要两个参数 - 经度和纬度 –