Mapbox-gl-js: minzoom seems not to work with custom layers

Created on 22 May 2020  路  4Comments  路  Source: mapbox/mapbox-gl-js

I have used the mapbox example from Add a 3D model but when I add minzoom : 17, property to the layer definition is not hidden once the zoom out is lower, but it works well with other fill or fill extrusion layers.
Is this a known bug, a constrain or by design decision?

mapbox-gl-js v1.10.1:

browser:

Steps to Trigger Behavior

  1. Just add minzoom : 17, to the fiddle sample Add a 3D model

Link to Demonstration

Here's the test fiddle

Expected Behavior

The Layer should hide as any other layer

Workaround

I found a workaround but must be done after the layer is created through addLayer which is not ideal. You must execute setLayerZoomRange explicitly, the attribute in the addLayer creation doesn't work for custom layers.
map.setLayerZoomRange('layername', 17, 22);

feature

Most helpful comment

Is this a know bug, a constrain or by design decision?

I wouldn't call it a bug because the Custom Layer Interface doesn't document any min/max zoom properties. That said, I think this would be a useful feature to add.

All 4 comments

Is this a know bug, a constrain or by design decision?

I wouldn't call it a bug because the Custom Layer Interface doesn't document any min/max zoom properties. That said, I think this would be a useful feature to add.

Although, this isn't a problem of missing capability, it's just not available in the initial add call. https://stackoverflow.com/questions/61918709/minzoom-seems-not-to-work-with-custom-layers-in-mapbox

Although, this isn't a problem of missing capability, it's just not available in the initial add call. https://stackoverflow.com/questions/61918709/minzoom-seems-not-to-work-with-custom-layers-in-mapbox

thanks that鈥檚 my own question and workaround 馃槀馃槀馃槀

Hah, I didn't even see the Workaround in the top post :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shotor picture shotor  路  3Comments

yoursweater picture yoursweater  路  3Comments

stevage picture stevage  路  3Comments

PBrockmann picture PBrockmann  路  3Comments

muesliq picture muesliq  路  3Comments