To restrict the zoom level in Google Maps, you can use the
minZoom
and
maxZoom
options when you create the map object. These properties allow you to define the minimum and maximum zoom levels that the user can zoom in and out to.
For instance, a typical city level view is around the zoom level of 10. Therefore, you can set both
minZoom
and
maxZoom
to 10 to restrict the map to a city level view.
Here's how you can modify your
initMap
function to include these options:
JavaScript:
function initMap()
{
DBTech.MemberMap.config.map = new google.maps.Map(document.getElementById('dbtech_membermap_map'), {
center: {lat: DBTech.MemberMap.config.lat, lng: DBTech.MemberMap.config.long},
zoom: 10,
minZoom: 10,
maxZoom: 10
});
DBTech.MemberMap.initMap();
}
In the code above, I've added an instantiation of
google.maps.Map
to the
DBTech.MemberMap.config.map
property. This map object is centered at the latitude and longitude specified in
DBTech.MemberMap.config.lat
and
DBTech.MemberMap.config.long
, with a zoom level set to 10. The
minZoom
and
maxZoom
options are also set to 10, effectively restricting the map to a city level view.
Please note that you will need to adjust the latitude and longitude values to match your specific requirements.