[OpenLayers-Users] Cache maps with OSM

hz hanks hankshz at gmail.com
Mon Sep 24 13:18:53 PDT 2012


Hey, Stephen:

Downloading the completed data is feasible but, as you mentioned, need
much larger disk to store the data. My idea is just to simulate the
internet user's process and cache the tiles that are received during
that preview process. So the cache may not be perfect but can be used
for offline easily. So from where I can manipulate those tiles I want,
if I'm using OpenLayer? Or the idea is not feasible?

Best,
Hanks

2012/9/21 Stephen Woodbridge <woodbri at swoodbridge.com>:
> On 9/21/2012 8:53 PM, hz hanks wrote:
>>
>> Hey, All:
>>
>> I have created a simple web based map application using
>> OpenLayers.Layer.OSM. Now I'm asked to cache part of the map in
>> advance. ( Say, cache it when it's accessible to the Internet and then
>> we may move the laptop to a place without the Internet. )
>>
>> My idea is to use setCenter( center, zoom ) function to change the
>> zoom argument and let the OpenLayer to cache the data. I went through
>> the example of offline-storage.js provided by OpenLayer and now how to
>> add cache control. But how can I make sure that all data is cached
>> before I change the zoom argument again? I tried to register event
>> "loadend" ( change the zoom argument after "loadend" is triggered )
>> but it didn't work. Did I choose a wrong event? Or is this idea not
>> feasible ( caching every tile that has been displayed is not
>> guaranteed? ). Is there any other way to do that (e.g. create a
>> offline map of a desired area) and how?
>
>
> This is not a function or capability of OpenLayers, but that said you might
> want to ask this question on the Mapserver.org list regarding mapcache.
>
> The idea being to set up apache2 on your laptop with mapcache installed and
> configured to pull tiles from OSM, then configure your OpenLayers app to
> pull tiles from mapcache. Mapcache will pull and cache the tiles locally as
> they are requested or you can run a seeder that will pre-populate the tiles.
>
> There are two problems that I see with this setup:
>
> 1. unless you have a huge disk you will need to write a script to clean
> tiles that you do not need.
>
> 2. you need to write a script to run the seeder and pull the area of
> interest that you are interested in, before you go offline.
>
> Hope this helps,
>   -Steve W
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list