Controlling Viewable Area and Zoom Level in Google Maps v3
To restrict the viewable area in Google Maps v3, you can set the map's bounds using the setOptions() method. For example, to limit the view to a specific country:
map.setOptions({ bounds: { north: 50, south: 20, west: -100, east: -50 } });
Restricting the zoom level can be achieved through options or event handling. To limit the zoom level using setOptions():
var zoomOptions = { minZoom: 6, maxZoom: 9 }; map.setOptions(zoomOptions);
Alternatively, you can use the zoom_changed event to dynamically check and reset the zoom level when it exceeds the specified limits.
The above is the detailed content of How to Control Viewable Area and Zoom Level in Google Maps v3?. For more information, please follow other related articles on the PHP Chinese website!