5
如何在不改變地圖範圍/縮放的情況下將KML作爲Google地圖(javascript v3)中的圖層添加?如何在不更改地圖中心的情況下在Google地圖中加載KML
我正在添加一個KML,其中有幾個事件遍佈世界各地,因爲這個谷歌地圖javascript v3將地圖範圍更改爲非常大的縮小視圖。
下面是一些示例代碼:
function loadOverlay(inc)
{
var overlay = new google.maps.KmlLayer(inc);
overlay.setMap(map);
overlayArray.push(overlay);
}
function initialize_gmap()
{
var Rochester = new google.maps.LatLng(43.1561, -77.607);
var myOptions = {
zoom: 11,
center: Rochester,
mapTypeId: google.maps.MapTypeId.TERRAIN
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
//Then i initialize the map here, and load the kml
initialize_gmap();
loadOverlay("linktokml.kml");
後的KML加載它關係到一個非常大的放大,顯示在KML所有位置。 我會如何防止這種情況,或返回到我的初始範圍/縮放?
在此先感謝。