Best way to toggle leaflet tooltip depending on zoomlevel?
<p>I love leaflet's new tooltips, but I hate clutter. I have three layers in a small project, and I'd like a certain set of each of the layers to have their tooltip visible at "all" zoomlevels (14+), a second tier—2—visible at 15+, and so on.</p>

<p>The three layers are <code>L.geoJSON</code>, so for now, I've got a property, <code>tier</code>, that is an integer (1–4).</p>

<p>This works:</p>

<pre><code>map.on('zoomend', function(){
  // the three geoJSON layers
  var layers = [institutionsLayer, patronsLayer, essayPatronsLayer];
  layers.forEach(function(layer){
    var features = Object.keys(layer._layers);
    features.forEach(function(feature){
      if(map.getZoom() - layer._layers[feature].feature.properties.tier &gt;= 13){
        layer._layers[feature].openTooltip();
      } else {
        layer._layers[feature].closeTooltip();
      }
    });
  });
});
</code></pre>

<p>But this seems like an awful hack. </p>

<p>Is there an option or something for min and max zoom values for something to be visible?</p>

<p>I know there is on ArcGIS online and I think Carto.</p>

<p>It's in action here:</p>

<p><a href="https://muziejus.github.io/mep-leaflet-mvp/" rel="nofollow">https://muziejus.github.io/mep-leaflet-mvp/</a></p>