1 | initial version |
Yes, it is possible to adjust the zoom level after using the fitBounds method in Google Maps API v3. You can use the setZoom method to set the new zoom level. For example:
// Create a new map
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: {lat: 37.7749, lng: -122.4194}
});
// Create a LatLngBounds object
var bounds = new google.maps.LatLngBounds();
// Extend the bounds to include multiple locations
bounds.extend(new google.maps.LatLng(37.7749, -122.4194));
bounds.extend(new google.maps.LatLng(37.7749, -122.4195));
bounds.extend(new google.maps.LatLng(37.7748, -122.4194));
bounds.extend(new google.maps.LatLng(37.7748, -122.4195));
// Fit the map to the bounds
map.fitBounds(bounds);
// Set a new zoom level
map.setZoom(12);