[Tilecache] dir & file naming algorithm

Charlton Galvarino charlton at 2creek.com
Thu Jul 30 15:57:01 EDT 2009


Hi, all.  I'm having a mental block why I can't reverse engineer the directory- and file-naming conventions used on a completely seeded layer.

Say that my request is http://somwhere.com/nws-cgi/tilecache-2.10/tilecache.cgi/1.0.0/ww/5/8/13.png?type=google.  I'm not a python programmer, but I believe that this is the meat of what I'm after:

    def getKey (self, tile):
        components = ( self.basedir,
                       tile.layer.name,
                       "%02d" % tile.z,
                       "%03d" % int(tile.x / 1000000),
                       "%03d" % (int(tile.x / 1000) % 1000),
                       "%03d" % (int(tile.x) % 1000),
                       "%03d" % int(tile.y / 1000000),
                       "%03d" % (int(tile.y / 1000) % 1000),
                       "%03d.%s" % (int(tile.y) % 1000, tile.layer.extension)
                    )
        filename = os.path.join( *components )
        return filename

So by that logic, I believe the filename I want is /ww/05/000/000/008/000/000/013.png.  However that image doesn't exist on disk.  The one that visually matches that CGI request is really /ww/05/000/000/008/000/000/018.png which does exist and looks beautiful.

What the devil am I doing wrong?

Note that everything works splendidly when preseeding as well as overlaying the tiles via CGI onto a google map.  That's not the issue.

And why am I doing this?  The eventual host is CGI-phobic but does play PHP.  Since all the images have been preseeded, I'll wrap the logic that I'm trying to reverse engineer above in a little PHP script and send the image along.

TIA,

Charlton





Charlton Galvarino
1 (803) 233-6205 : voice
1 (803) 223-9579 :   fax
charlton at 2creek.com

P.O. Box 50960
Columbia, SC 29250




More information about the Tilecache mailing list