0
我有COORDS的幾個陣列,以及我需要吸引超過1個多邊形如何繪製多於一個的多邊形。谷歌API
function testarr()
{
polygon1 = [new google.maps.LatLng(54.66092513983568, 39.71935272216797),
new google.maps.LatLng(54.63847909506459, 39.718666076660156),
new google.maps.LatLng(54.63748562083948, 39.77668762207031),
new google.maps.LatLng(54.66430090574764, 39.77668762207031)];
polygon2 = [new google.maps.LatLng(54.605482774276126, 39.713172912597656),
new google.maps.LatLng(54.58817883247707, 39.714202880859375),
new google.maps.LatLng(54.58917351104145, 39.734458923339844),
new google.maps.LatLng(54.607073572207575, 39.7320556640625)];
polygonpolygon.push(polygon1);
polygonpolygon.push(polygon2);
}
如何創建新座標新的多邊形,如果我不知道有多少個多邊形需要什麼?
我嘗試這一點,但它了錯誤:
var polyg = new google.maps.Polygon({
fillColor: 'blue',
path: polyarr111,
strokeWeight: 3
});
for (var u=0; u<2; u++) {
polyg.setPaths(new google.maps.MVCArray(polygonpolygon[u]));
};