我正在尝试从谷歌地图 v3 api 创建一条折线。我知道如何在点击时添加折线,但我想从纬度和经度值创建折线,这将在循环中。我怎样才能做到这一点 ?
var network_url = decodeURIComponent(document.URL);
//var network_url = " http://testNetwork.com?param[]=(12.983147333223707, 77.49687217431642)¶m[]=(12.95035965289418, 77.54871391015627)";
var location_array = split_url(network_url);
for(var i = 0; i<location_array.length; i++)
{
//(12.960062579720846,%2077.48313926416017)
var loc = location_array[i] ; //==>(12.77, 24.87)
var split_arr1 = loc.split("(");
var result_split_arr1 = split_arr1[1].split( ")" );
var split_latLon = result_split_arr1[0];
var result_split = split_latLon.split(",");
var split_lat = result_split[0];
var split_lon = result_split[1];
marker = new google.maps.Marker({
position: new google.maps.LatLng(split_lat, split_lon),
map: map
});
///////////POLYLINE DRAWing /////////////////////////////
/////////////END OF POLYLINE ////////////////////
}
}
谢谢你。