2012-02-10 96 views

回答

0

你的地圖顯示the right viewport的唯一setCenter()setZoom()呼叫我看,這相當於通過選項給Map構造:

google.maps.Map(document.getElementById("map_canvas"), { 
    zoom: 14, 
    center: new google.maps.LatLng(64.8504701658,-147.856123924), 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
}); 
+0

謝謝Miguev會給這個鏡頭。 – 2012-02-13 19:11:14

4

這是你的地圖的最佳變焦:

map.setCenter(new google.maps.LatLng(64.85599578876611, -147.83363628361917)); 
map.setZoom(15); 
+0

謝謝你的幫助。我會試一試。 – 2012-02-13 19:10:24

+0

這爲我工作,謝謝你謝謝你Broady,我看到它是我的LatLng關閉我想我找到其他東西來抓住這些。真的非常感謝您非常感謝您的幫助。 – 2012-02-13 19:20:28

+0

沒問題!我在Google地圖上使用了「Drop LatLng marker」實驗室。你能接受答案嗎? :) – 2012-02-14 05:57:03

1

我加了setZoom(11)之後map.fitBounds(bounds)。它爲我工作。 試試吧。

setMarkers(map) 
    { 
     var bounds = new google.maps.LatLngBounds(); 
     for(var i=0;i<this.markers.length;i++) 
     { 
      bounds.extend(this.markers[i].getPosition()); 
      map.setCenter(this.markers[i].getPosition()) 
      map.fitBounds(bounds); 
      map.setZoom(11); 
     } 
    }