I'm trying to make a user controlled cross-layer animation in Leaflet. I have about 70 tileLayer.wms layers, that need to be preloaded on the map before animation can run.

The question is - is there a way to preload tiles before showing them? Ideally, I would like to have something like a progress bar, or a spinning clock icon, while this process takes place.

  • Hi @nextstopsun! To fit the Q&A format of StackExchange, we need precise questions :) Could you please split this question of yours and create a new one for the second one?
    – MattiSG
    Commented Oct 23, 2012 at 20:18
  • Ok, I've cut the second part. Commented Oct 23, 2012 at 20:33

1 Answer 1


I don't know of any Leaflet-specific way to do this.

However, you could preload all images asynchronously and let the browser's cache handle everything for you.

All major JS libraries let you do asynchronous resource loading very easily, including binding the loads with whichever progress indicator you'd like. You'll just have to make sure your server is set up so that the images to load have proper Expires and Cache-control headers to leverage caching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.