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

Bill Woodall bwoodall at wardrobe.dhs.org
Sat Feb 24 17:53:43 EST 2007


On Sat, 2007-02-24 at 09:15 -0500, Christopher Schmidt wrote:
> 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.

One of the sites for WW files is 
http://www.worldwinddata.com/


The directory structure is not always consistent after the "Cache" in
C:\Program Files\NASA\World Wind 1.3\Cache

Examples
Moon \ Images \ Clementine 40XX \ <z> \ <x> \ <x>"_"<y>"."<extension>
BMNG \ BMNG (Shaded) Tile - 12.2004 \ <z> \ <x> \<x>"_"<y>"."<extension>

So taking your example with a minor change should work if you can put
the layer.name as "Moon\Images\Clementine 40XX" or
"BMNG\BMNG (Shaded) Tile - 12.2004";

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

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




More information about the Tilecache mailing list