- The client has an ArcGIS Server with a tile service. We set up a Leaflet map for them showing these tiles, a couple of years back.
- They now have dynamic services. They are not fast enough for production use at far-out zoom levels, but they are available at deeper scales than the tiles.
- Can we have the map detect that they've zoomed in far enough, and silently switch between the two? Tiles when far-out and dynamic when close-in?
https://github.com/GreenInfo-Network/L.TileLayer.TiledAndESRIDynamicTandem
This uses the ESRI-Leaflet adapter, and creates within itself both a L.TileLayer and a L.ESRI.DynamicMapLayer. It then watches the map's zoomend event and does what it should do.
Our needs here were pretty specific, so there are a few things it does and does not support. If needs change, or someone else is interested, maybe this could be developed further.
- It has a setOpacity() method which will apply to both sub-layers. During this I discovered and had to work around some behaviors of the dynamicMapLayer class, e.g. one cannot set its opacity if it is not in the map at that time (one can with L.TileLayer).
- Options are passed to both layers as-given, e.g. the *attribution* is the same for both. In this case that's perfect.