Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support maxNativeZoom #108

Open
nvx opened this issue Jan 2, 2022 · 4 comments
Open

Support maxNativeZoom #108

nvx opened this issue Jan 2, 2022 · 4 comments

Comments

@nvx
Copy link

nvx commented Jan 2, 2022

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.

@jwasilgeo
Copy link
Contributor

Support for maxNativeZoom in the main esri-leaflet project was added in pull request Esri/esri-leaflet#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

@nvx
Copy link
Author

nvx commented Jan 5, 2022

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/

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.

@jwasilgeo
Copy link
Contributor

@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.

@patrickarlt
Copy link
Contributor

I think this will actually be resolved by #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants