开发者

Openlayers offline caching for iPad

I am buildi开发者_如何学运维ng an HTML5 app for an iPad and it will contain a map for basic contextual information. I need some way to cache the map offline selectively (i.e. I am going to an area that I know is without connectivity so let me cache that part of the map beforehand).

Alternatively I can render vector layers from a WebSQL repository of them and in that case how would I convert maps to vector and display these vectors in a panning map (i.e. Swap between or add too vector layers)

Thanks in advance


I know that some guys were experimenting on local storage support during OpenLayers Mobile Codesprint back in February. Here is an example of what they've accomplished. I recommend that you checkout jgrocha's sandbox and take a look if what they did suits your needs.


Looks like touchMapLite has some offline caching features. I have not dug too far into it to see how well (or if) it works, but you can see in the code that there are examples of populating and retrieving cached map tiles

http://sourceforge.net/projects/touchmaplite/


I've done this using a cloudmade tms layer togeteher with some inspiration from the openlayers sandboxes.

In short, you've to set the async property of an layer to true and provide a getURLasync method for that layer. In this method you can check if the layer is in a local storage / webdatabase and else load the tile from the web.

The getURLasync method has the image as property wich can be user to convert it to a dataurl string, which is needed to store the tile if not present in the offline cache.

You can find some example code here: http://allartk.nl/content/html5-offline-mapping


I have used an ipod touch app called OffMaps. It caches everything you look at directly on the ipod, then you can use the map program later when not on wifi and those tiles are still there. No idea how they did it, but it proves its possible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜