[Tilecache] Caching a raster saved on the local disk

Simone Gadenz simone.gadenz at jrc.it
Tue May 6 04:18:42 EDT 2008


Following the current post I tried to cache a local image using the image
layer. I had exactly the same problem showed in this post at the beginning
of this year:
http://openlayers.org/pipermail/tilecache/2008-January/000686.html.

Doing some investigation it turned out that the line that fails is the 

self.image = Image.open(self.file)

into the Image.py file.

I am not a pyton programmer at all, I did a simple test that was to run the
followung code into a single file and then to include the same code into the
Image.py. 

import sys
import Image

for infile in sys.argv[1:]:
    try:
        im = Image.open(infile)
        print infile, im.format, "%dx%d" % im.size, im.mode
    except IOError:
        pass


It worked as single file but it failed into the Image.py
What I find really strange is that also the other layers defined in the
config file that were working before the introduction of the new imagelayer
definition stopped working.
The error is not demepnding on the layer called and it is:


C:\Inetpub\wwwroot\ts\TileCache>tilecache_seed.py
"http://139.191.1.147/ts/tile
ache/tilecache.cgi?" simone 0 6
C:/MapData/TestLargeRaster/prova.jpg
Traceback (most recent call last):
  File "C:\Inetpub\wwwroot\ts\TileCache\tilecache_seed.py", line 9, in
<module>
    TileCache.Client.main()
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Client.py", line 96, in
main
    layer = svc.layers[sys.argv[2]]
KeyError: 'simone'


Ideas?


Simone


-----Original Message-----
From: fredrik.lundh at gmail.com [mailto:fredrik.lundh at gmail.com] On Behalf Of
Fredrik Lundh
Sent: lunedì 5 maggio 2008 14.18
To: Simone Gadenz
Subject: Re: [Tilecache] Caching a raster saved on the local disk

> is it possible to create a cache structure for an image stored on the
local
> disk? In case what would be the best strategy to integrate this
> functionalities into the existing scripts? Would be possible to reuse
> functions for cutting metatiles?

sounds like the ImageLayer handler is what you want; see the first two
configurations on this page for examples:

http://svn.tilecache.org/tags/tilecache/release-2.01/docs/EXAMPLES.txt

</F>




More information about the Tilecache mailing list