The documentation advertises that the visibility layout property for any layer type can be a function. As far as I can tell, this isn't true: neither gl-js nor gl-native nor Mapbox Studio support using functions for visibility. Furthermore, the use case for doing so seems marginal:
Using a non-data-driven function for visibility would be basically equivalent to using minzoom and maxzoom. A visibility function is slightly more flexible; for example you could have a layer be hidden between a certain minimum and maximum zoom, but visible outside of it.
Using a data-driven function for visibility would provide a subset of what filter can do.
I think we should revise the documentation to indicate that visibility cannot be a function.
The documentation advertises that the
visibility
layout property for any layer type can be a function. As far as I can tell, this isn't true: neither gl-js nor gl-native nor Mapbox Studio support using functions forvisibility
. Furthermore, the use case for doing so seems marginal:visibility
would be basically equivalent to usingminzoom
andmaxzoom
. Avisibility
function is slightly more flexible; for example you could have a layer be hidden between a certain minimum and maximum zoom, but visible outside of it.visibility
would provide a subset of whatfilter
can do.I think we should revise the documentation to indicate that
visibility
cannot be a function.