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 am working on an extension to openlayers to pre-cache tiles in a local websql datastore to support mapping on mobile device when connectivity is dead.

I would like to pre-seed my cache with a set of tiles. Currently this has to be done by visiting the area in question and using the cacheWrite control.

This would be done by fetching the tiles in question from my wms mapserver and storing them locally in the websql database. These would then be available for the cacheRead control to use on tileerror.

So, my question is: given a bounding box, is there an easy way for me to construct these calls using openlayers and hence populate the cache with the required tiles for a required zoom level?

A sample single tile call is:-


I can do this by panning the map about automatically, but the user experience is terrible ;-)

share|improve this question
Further investigation shows that the key to this will be the Openlayers grid object which contains the tiles. Each tile has a method to return its url for a given zoom level. I am unclear as to whether the grid covers the current viewport or the whole map at the moment – user1331131 Jul 29 '13 at 8:21
Why don't you a preached WMTS service instead? The URL for the tiles in that case is far more easier to work with. – Devdatta Tengshe Jul 30 '13 at 9:54

Your Answer


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

Browse other questions tagged or ask your own question.