esri-leaflet: The maxNativeZoom option of the layer is not being set when using L.esri.basemapLayer

Bug

The maxNativeZoom option of the layer is not being set when using the method L.esri.basemapLayer('Streets') along with the options object. This means that some parts of the map display the “Map data not yet available” when the zoom level is greater than 19.

I’ve tried two different ways of setting the maxZoomLevel, both unsuccessful:

var map = L.map('map');
L.esri.basemapLayer('Imagery', { maxNativeZoom: 19}).addTo(map);
var map = L.map('map');
var layer = L.esri.basemapLayer('Imagery');
layer.options.maxNativeZoom = 19;
layer.addTo(map)

Expected Behavior

The map should be auto-scaled when zooming over the set maxNativeZoom preventing the “Map data not yet available” tiles from being displayed. Using the L.tileLayer Leaflet method with the appropriate Url for Imagery and setting the maxNativeZoom option does result in the expected behavior.

Screenshots

image

Environment Information

  • Version of Leaflet (L.version): 1.6.0
  • Version of Esri Leaflet (L.esri.VERSION): 2.3.2
  • Your OS: Windows 10
  • Browser and Version: Chrome 83.0.4103.116

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (15 by maintainers)

Most upvoted comments

@Diegodlt thanks for opening this issue in the first place. You should be able to control the maxZoom and maxNativeZoom as you wish the next time we publish a release of this library. As for the other items we all discussed and identified, the conversation can continue in #1222.

Now I want to backtrack a little on what I just said above. I’ve often found myself going back & forth on these different ideas, all of which have merit. 😄

I’m leaning towards reverting #1011 to give the Imagery basemap layer full control over its maxZoom option (and maxNativeZoom option) to allow for those special cases where developers really want to change them. As @patrickarlt mentioned we would then default and cap maxZoom at 19.

I think your enhancements in #1011 are very interesting, useful, and clever, @jgravois. What if we were to put that in the issue backlog and revisit once we understand how to deal with the missing tiles behavior described in https://github.com/Esri/esri-leaflet/issues/1210#issuecomment-662691014, https://github.com/Esri/esri-leaflet/issues/1210#issuecomment-662772699, and https://github.com/Esri/esri-leaflet/issues/1210#issuecomment-663065941?

I’m (clearly) open to being talked into something else if anyone has other thoughts or feelings about this, and then when we settle on our approach I am happy to work on what we agree to. Thanks y’all!

Are you saying you want to set that to something different?

yup. it sounds like he’s trying to override the resampling i landed in #1011.

min and max zoom are set here (example here) for each basemap.

user supplied constructor options should definitely supersede any defaults set internally.