Change maxZoom parameter at runtime to ol.View in Openlayers 3

I am trying to change the maxZoom parameter after activating the map functionality. Thus, it must be at run time so that it can be dropped to the original maxZoom.

By creating ol.View, you configure these settings as follows:

new ol.View({
            ...
            zoom: 10,
            maxZoom: 17,
            minZoom: 10,
});

however api allows you to zoom using setZoom ()

+1
source share
1 answer

You can do this by completely changing the map view:

map.setView(new ol.View({
  zoom: 10,
  maxZoom: 17,
  minZoom: 10,
}));

Edit:

A jsfiddle for testing a solution

+1
source

All Articles