2011-06-05 135 views
1

当我输入一个地点(城市或国家)和信息窗口打开时,下面的代码只能找到打开信息窗口的区域内的位置:谷歌地图API V3地理编码视

function codeAddress() { 
var address = document.getElementById("address").value; 
geocoder.geocode({ 'address': address}, function(results, status) { 
    if (status == google.maps.GeocoderStatus.OK) { 
    map.setCenter(results[0].geometry.location); 
    map.fitBounds(results[0].geometry.viewport); 
     } else { 
    alert("Sorry, we couldn't find the location for the following reason: " + status); 
    } 
}); 

}

我想放大的位置视而不fitBounds

这种作品:

map.setZoom(13); 

但我不希望指定缩放级别

下面是后者的代码的链接:http://www.hostelbars.com/map_test_v3_3.html

我会很感激一些帮助 - 谢谢!

回答