Reputation: 954
I list my users on the google maps based on their locations. But I dont want it zoom in to a degree where others can see on what street they live. Is there a way to disable "zoom in" feature in the following Google maps codes?
Thanks!
function initialize() {
var data = <%=Data%>;
var center = new google.maps.LatLng(48.404840395764175, 2.6845264434814453);
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var markers = [];
for (var i = 0; i < data.users.length; i++) {
var location = data.users[i];
var latLng = new google.maps.LatLng(location.latitude, location.longitude);
var marker = new google.maps.Marker({ position: latLng });
markers.push(marker);
}
var markerCluster = new MarkerClusterer(map, markers);
}
google.maps.event.addDomListener(window, 'load', initialize);
Upvotes: 2
Views: 4831
Reputation: 1246
This can be used to disable scroll when mouse is hovered over map.
scrollwheel: false
Upvotes: 2
Reputation: 165971
You can add minZoom
and maxZoom
properties to the options object you pass to the Map
constructor:
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP,
maxZoom: 10
});
From the docs for maxZoom
:
The maximum zoom level which will be displayed on the map. If omitted, or set to null, the maximum zoom from the current map type is used instead.
Upvotes: 5