1
我想將我所有的座標放入一個數組中,並且每個座標都顯示一個循環,但使用Google函數。從數組中檢索座標
下面的代碼,它借鑑了谷歌地圖的點:
var flightPlanCoordinates = [
new google.maps.LatLng(37.772323, -122.214897),
new google.maps.LatLng(21.291982, -157.821856),
new google.maps.LatLng(-18.142599, 178.431),
new google.maps.LatLng(-27.46758, 153.027892)
];
我希望能夠做這樣的事情:
var arrPos = new Array([37.772323, -122.214897], [21.291982, -157.821856], [-18.142599, 178.431], etc.);
var flightPlanCoordinates = [ +
for (i=0; i<arrPos.length; i++){
new google.maps.LatLng(arrPos[0]) + ", "
}
+ "];"
我知道你可以把一個循環,一個數組,但有沒有一種替代方法來檢索數組中的點?
TKS