Open nvx opened 2 years ago
Support for maxNativeZoom
in the main esri-leaflet
project was added in pull request https://github.com/Esri/esri-leaflet/pull/904, specifically for the L.esri.TiledMapLayer
which extends from L.TiledLayer
, which itself extends from L.GridLayer
which has the maxNativeZoom
option.
But, this esri-leaflet-vector
plugin does not have this inheritance chain back to L.GridLayer
. It uses a combination of Leaflet's L.Layer
and mapbox-gl-js
. We'll have to think of another way to deal with this.
This GIS StackExchange answer looks promising to me: https://gis.stackexchange.com/a/330575
Can you try to use the L.esri.Vector.vectorTileLayer
style
construction function option and add your own mapbox style spec maxzoom
for your source(s) property(ies)?
https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/
Plugin docs: https://esri.github.io/esri-leaflet/api-reference/layers/vector-layer.html#options https://github.com/Esri/esri-leaflet-vector#lesrivectorvectortilelayer
Can you try to use the
L.esri.Vector.vectorTileLayer
style
construction function option and add your own mapbox style specmaxzoom
for your source(s) property(ies)? https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/
I'd tried this already and unfortunately no dice.
What did seem to work though was overriding the request function to intercept the XHR to load the /VectorTileServer?f=json url and truncating the returned json response.tileInfo.lods down. Obviously monkeypatching the request like I resorted to is a bit iffie, but I imaging doing the same logic as it loads the metadata would be fairly straightforward.
@nvx can you give us a public jsbin/codepen/etc. to look at this? Can you tell us more about the maxzoom
style spec and your comment?
I'd tried this already and unfortunately no dice.
I think this will actually be resolved by https://github.com/Esri/esri-leaflet-vector/pull/166 when we start looking at minLOD
/maxLOD
from the service. I'm going to leave this open though because eventually I want to request all the services we find the sources
object in the style, request the service metadata and set allthe minzooms
and maxzoom
properties for each service.
Most layers in leaflet support setting maxNativeZoom to allow combining layers that have different maximum zoom levels in the one map. It looks like the L.esri.Vector.vectorTileLayer layer unfortunately doesn't support this option though.