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

Possible to cancel pending dynamic map service layer requests? #498

Closed
green3g opened this issue Apr 2, 2015 · 2 comments
Closed

Possible to cancel pending dynamic map service layer requests? #498

green3g opened this issue Apr 2, 2015 · 2 comments

Comments

@green3g
Copy link

green3g commented Apr 2, 2015

I'm using L.esri.dynamicMapLayers and when the map is panned or zoomed quickly, the map flashes as it loads each frame. Just wondering if its possible to cancel pending map service requests when the map is panned or zoomed while the layer is loading, so that this doesn't occur.

Its difficult to reproduce on the samples, probably because the esri services are much faster, but here is the dynamic example: http://esri.github.io/esri-leaflet/examples/simple-dynamic-map-layer.html

To reproduce, just zoom and pan around rapidly. It loads each frame quickly, but on a slower server, the frames take much longer to load and the map may continue loading for several seconds after the user stops panning.

@patrickarlt
Copy link
Contributor

There is some odd flashing. The behavior right now loads all images at 0% opacity and then turns the opacity up to the correct amount if its the right images to show. I feel like the conditional on https://github.com/Esri/esri-leaflet/blob/master/src/Layers/RasterLayer.js#L155 should read newImage._bounds.equals(bounds) && newImage._bounds.equals(map.getBounds) which would make only images that fill the current view of the map show up.

Canceling the requests will be difficult since they aren't real requests by default just <img> tags which can't be canceled but you can also enable JSON requests (for proxying and auth) which in some cases CAN be canceled.

That said I want to revist canceling requests for some other parts of the API. I've tried before but it cased to many problems with the tests.

@patrickarlt
Copy link
Contributor

@roemhildtg I got it working with the above fix. If the map is panned and zoomed rapidly each intermediary frame is not shown only the final frame that fills the current view of the map.

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

No branches or pull requests

2 participants