[Tilecache] [OpenLayers-Users] using OpenLayers offline via TileCache?

Christopher Schmidt crschmidt at metacarta.com
Sat Feb 24 09:15:20 EST 2007


On Thu, Feb 22, 2007 at 05:45:42AM -0500, Fowlkes, Daniel G NETCOM-ARMY GNOSC wrote:
> I need to be able to use OpenLayers when offline.  Is it possible to do
> this by dropping WorldWind cache packs into TileCache run locally?
> Thank you.

The answer to this would probably be to write a different Cache subclass
(instead of the DiskCache, you could have a WWCache.) This seems like an
interesting ability (one I hadn't thought of, since I've never been able
to *find* a WW cache pack) -- if you could point me to a file the next
time I'm hacking on TileCache, I'll take a look at it.

Alternatively, I'll gladly take a patch if you write one.

I *think* what you should be able to do is something like this:

class WWCache(DiskCache):
    def getKey(self, tile):
        components =  (self.basedir, tile.layer.name, tile.z, 
                       "%s_%s.%s" % (tile.x, tile.y,
                       tile.layer.extension))
        return os.path.join( *components )

(And not modify anything else -- the other functions are all fine to
come straight out of the DiskCache.) 

Or something similar. This assumes that the WW cachepack structure is
layername/zoom/x_y.jpg -- if this isn't right, you'd need to modify
accordingly. Then, you could just modify your tilecache.cfg to point to
this cache type.
                      
Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list