maxZoom and User Input

Mia picture Mia · Jan 29, 2013 · Viewed 19.2k times · Source

I want to limit the users max zoom level with inputs (muse scroll etc.) and buttons. In other words, I limit the "maxZoom" to -lets say- level9. But I still want to be able to zoom to level10 in special conditions. When I set the maxZoom, it obviously does not let me zoom more in any way, so wht is my solution in this case?

Answer

Rahul G Nair picture Rahul G Nair · Feb 4, 2013

For setting maximum zoom level :

map._layersMaxZoom=15 (which sets the maximum zoomlevel as 15)

Similarly we can set minimum zoom level:

map._layersMinZoom=2, (which sets minimum zoomlevel as 2).

Another way of doing the same-

map.options.maxZoom = 15;

map.options.minZoom = 10;