I want to change the minzoom of dynamically created layer after the rendering.

I tried couple of things:

map.getLayer('my_custom_layer'); // this gets the layer

map.getLayer('my_custom_layer').minzoom = 5;

map.setPaintProperty('my_custom_layer', 'minzoom', 5); // couldn't make this work at all.

Is it possible to change the layer's zoom programatically after it's created and rendered?


Use map.setLayerZoomRange:

map.setLayerZoomRange('my-layer', minzoom, maxzoom);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.