esri-leaflet icon indicating copy to clipboard operation
esri-leaflet copied to clipboard

DynamicMapLayer clears old image when you move map

Open ogix opened this issue 5 years ago • 7 comments

  • Browser and version:

All

  • Version of Leaflet (L.version):

1.3.4

  • Version of esri Leaflet (L.esri.VERSION):

2.2.3

Steps to reproduce the error:

  1. Create a dynamicMapLayer
  2. Wait until layer is loaded
  3. Move map outside of layer bounds
  4. Return map to same position again

What happens is the loaded layer image gone. You have to wait again until image is loaded.

I was expecting the layer image to stay in the same way as with WMS layer.

ogix avatar Sep 04 '18 07:09 ogix

it's near impossible to pan the map to exactly the same location. that said, I guess technically we could wait to remove the old image until after the next one is retrieved.

the relevant code is here if anyone is interested: https://github.com/Esri/esri-leaflet/blob/master/src/Layers/RasterLayer.js#L48

jgravois avatar Sep 04 '18 12:09 jgravois

Maybe it is possible to make this layer extend from leaflet tileLayer and make it work in the same way as wms layer does?

ogix avatar Sep 04 '18 14:09 ogix

I don't think it would make sense to extend from tileLayer. DynamicMapLayer is not based on tiles. I fetches one image created dynamically on the server (as opposed to many cached tiles) for each pan/zoom.

Do you see the behavior you expect when working with any other type of non-tiled layer?

tomwayson avatar Sep 04 '18 14:09 tomwayson

WMS is a dynamic service type too. Leaflet likely just uses a grid to cache requests.

https://github.com/Leaflet/Leaflet/blob/master/src/layer/tile/TileLayer.WMS.js

I'd be interested in seeing a PR and evaluating the result for dynamicMapLayer if anyone is interested in tackling it. it doesn't look like it'd take much code.

jgravois avatar Sep 05 '18 07:09 jgravois

@jgravois @ogix was this fixed already, following the first non-tiling approach mentioned above?

wait to remove the old image until after the next one is retrieved

The order of operations seems good to me now that I'm going back and stepping through RasterLayer.js and what it extends from.

jwasilgeo avatar Sep 23 '19 15:09 jwasilgeo

was this fixed already, following the first non-tiling approach mentioned above?

nope. no work has been done here.

jgravois avatar Sep 23 '19 19:09 jgravois

Alright, we've confirmed that the DynamicMapLayer does function as expected by design now, and will leave this open as a potential enhancement with the idea suggested here: https://github.com/Esri/esri-leaflet/issues/1124#issuecomment-418622194.

jwasilgeo avatar Oct 03 '19 16:10 jwasilgeo