Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 Oct 23 '12 at 20:18
Ok, I've cut the second part. – nextstopsun Oct 23 '12 at 20:33

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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