谷歌地图设置界限缩放级别
问题描述:
我有一个地图显示用户的位置并自动放大。 我想知道如何设置缩放级别为'zoom'和'maxZoom'不起作用。谷歌搜索后,似乎我需要设置界限,但不知道从哪里开始。 我希望把它放大到周围12谷歌地图设置界限缩放级别
下面是部分代码:
jQuery('#map_canvas').gmap('getCurrentPosition', function(position, status) {
if (status === 'OK') {
var clientPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
jQuery('#map_canvas').gmap('addMarker', {'position': clientPosition, 'bounds': true});
jQuery('#map_canvas').gmap('addShape', 'Circle', {
'strokeWeight': 0,
'fillColor': "#008595",
'fillOpacity': 0.25,
'center': clientPosition,
'radius': 15,
'clickable': false
});
}
});
答
使用google.maps.Map
-instance的setZoom的方法来应用自定义缩放后加入标记
jQuery('#map_canvas').gmap('get','map').setZoom(12);
完美,非常感谢! – user537137 2013-03-12 09:44:21