Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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:-

"http://mymapserver/pub/mapcache/mytheme?LAYERS=my_layer&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A27700&BBOX=533371.66,169851.66,534011.66,170491.66&WIDTH=256&HEIGHT=256"

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
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.