[Tilecache] Pregenerated tiles

Alexandre Dube adube at mapgears.com
Thu Nov 6 10:57:54 EST 2008


Mmm, in my mapfile I use this :

    OUTPUTFORMAT
        NAME "agg"
        MIMETYPE "image/png"
        DRIVER AGG/PNG
        EXTENSION "png"
        IMAGEMODE RGBA
        TRANSPARENT ON
        FORMATOPTION          "INTERLACE=OFF" <==
    END

But I extension=jpg in tilecache.cfg.  Returned image are really jpg 
images by tile cache.  I would prefer to use jpg because they are 
smaller.  But could that be the problem ?  Should I add an OUTPUTFORMAT 
jpg ?


Guillaume Sueur wrote:
> make sure mapserver generates non-interlaced PNGs as PIL doesn't support
> interlaced ones. You can set that with :
> FORMATOPTION "INTERLACE=OFF" in your OUTPUTFORMAT block
>
> regards
>
> Alexandre Dube a écrit :
>   
>> Hi again Guillaume,
>>
>> I tried to set metaSize=3,3 and the memory error no longer occurs. But (
>> unfortunately ), instead I have this new error which comes after
>> (around) a minute of running :
>> ...
>> ...
>> ...
>> Cache miss: 203199.891735,5390225.70122,204103.002359,5391128.81185,
>> Tile: x: 15, y: 18, z: 3, time: 0.890893936157
>> 03 (000015, 000018) = (203199.8917 5390225.7012 204103.0024
>> 5391128.8118) [0.8912s : 1.165/s] 102/176
>> Traceback (most recent call last):
>> File "./tilecache_seed.py", line 9, in <module>
>> TileCache.Client.main()
>> File "/home/mapgears/tilecache/TileCache/Client.py", line 108, in main
>> seed(svc, base, layer, map(int, sys.argv[3:5]), map(float,
>> sys.argv[5].split(",")))
>> File "/home/mapgears/tilecache/TileCache/Client.py", line 92, in seed
>> svc.renderTile(tile)
>> File "/home/mapgears/tilecache/TileCache/Service.py", line 138, in
>> renderTile
>> data = layer.render(tile)
>> File "/home/mapgears/tilecache/TileCache/Layer.py", line 429, in render
>> image = self.renderMetaTile(metatile, tile)
>> File "/home/mapgears/tilecache/TileCache/Layer.py", line 403, in
>> renderMetaTile
>> subimage = image.crop((minx, miny, maxx, maxy))
>> File
>> "/home/mapgears/fgs-5.2.0/lib/python2.5/site-packages/PIL/Image.py",
>> line 737, in crop
>> self.load()
>> File
>> "/home/mapgears/fgs-5.2.0/lib/python2.5/site-packages/PIL/ImageFile.py",
>> line 207, in load
>> raise IOError(error + " when reading image file")
>> IOError: decoding error when reading image file
>>
>> I asked one of my colleagues about it be he got no answer. Do you have
>> any clue about this new error ?
>>
>> Again, many many thanks for your great help,
>>
>> Alexandre
>>
>> Alexandre Dube wrote:
>>     
>>> Ok I'll try that, thanks a lot Guillaume.
>>>
>>> Alexandre
>>>
>>> Guillaume Sueur wrote:
>>>  
>>>       
>>>> ok, then it's the amount of memory used by the operation which is too
>>>> high for your system. Consider decreasing the metatile size or use
>>>> metatile false
>>>>
>>>> Guillaume
>>>>
>>>> Alexandre Dube a écrit :
>>>>      
>>>>         
>>>>> Hi Guillaume,
>>>>>
>>>>>  It was already set to :
>>>>>   MAXSIZE 4096
>>>>>
>>>>>  Is it to ok ?
>>>>>
>>>>> Alexandre
>>>>>
>>>>> Guillaume Sueur wrote:
>>>>>          
>>>>>           
>>>>>> Hi Alexandre,
>>>>>>
>>>>>> I think your MAXSIZE is too short in your mapfile (main MAP section)
>>>>>> It should allow images up to 1300 x 1300 to be drawn.
>>>>>> Try to set it to 1500
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Guillaume
>>>>>>
>>>>>> Alexandre Dube a écrit :
>>>>>>  
>>>>>>              
>>>>>>             
>>>>>>> Hi Guillaume,
>>>>>>>
>>>>>>>  I get the following after around 30 seconds of running :
>>>>>>> ...
>>>>>>> ...
>>>>>>> Cache miss: 196426.56206,5380743.03968,196878.117371,5381194.59499,
>>>>>>> Tile: x: 15, y: 15, z: 4, time: 1.48284912109
>>>>>>> 04 (000015, 000015) = (196426.5621 5380743.0397 196878.1174
>>>>>>> 5381194.5950) [1.4831s : 4.280/s] 61/247
>>>>>>> Traceback (most recent call last):
>>>>>>>  File "./tilecache_seed.py", line 9, in <module>
>>>>>>>    TileCache.Client.main()
>>>>>>>  File "/home/mapgears/tilecache/TileCache/Client.py", line 108, in
>>>>>>> main
>>>>>>>    seed(svc, base, layer, map(int, sys.argv[3:5]), map(float,
>>>>>>> sys.argv[5].split(",")))
>>>>>>>  File "/home/mapgears/tilecache/TileCache/Client.py", line 92, in
>>>>>>> seed
>>>>>>>    svc.renderTile(tile)
>>>>>>>  File "/home/mapgears/tilecache/TileCache/Service.py", line 138, in
>>>>>>> renderTile
>>>>>>>    data = layer.render(tile)
>>>>>>>  File "/home/mapgears/tilecache/TileCache/Layer.py", line 429, in
>>>>>>> render
>>>>>>>    image = self.renderMetaTile(metatile, tile)
>>>>>>>  File "/home/mapgears/tilecache/TileCache/Layer.py", line 391, in
>>>>>>> renderMetaTile
>>>>>>>    data = self.renderTile(metatile)
>>>>>>>  File "/home/mapgears/tilecache/TileCache/Layers/MapServer.py",
>>>>>>> line 51,
>>>>>>> in renderTile
>>>>>>>    mapImage = wms.draw()
>>>>>>>  File "/home/mapgears/fgs-5.2.0/www/lib/python2.5/mapscript.py", line
>>>>>>> 1363, in draw
>>>>>>>    def draw(*args): return _mapscript.mapObj_draw(*args)
>>>>>>> _mapscript.MapServerError: msDrawMap(): Image handling error.
>>>>>>> Failed to
>>>>>>> draw layer named 'mos'.
>>>>>>> msDrawRasterLayerGDAL(): Memory allocation error. Allocating work
>>>>>>> image
>>>>>>> of size 1300x1300 failed.
>>>>>>>
>>>>>>>  Do you know what can cause this ?  I use metaTile=true with default
>>>>>>> settings.
>>>>>>>
>>>>>>>  Thanks a lot for your help,
>>>>>>>
>>>>>>> Alexandre
>>>>>>>
>>>>>>> Guillaume Sueur wrote:
>>>>>>>                     
>>>>>>>               
>>>>>>>> cache miss is the normal message for non-existing tiles.
>>>>>>>>
>>>>>>>>
>>>>>>>> Alexandre Dube a écrit :
>>>>>>>>  
>>>>>>>>                           
>>>>>>>>                 
>>>>>>>>> I see,
>>>>>>>>>
>>>>>>>>>  I've got a lot of "cache miss" message and finally a  "Memory
>>>>>>>>> allocation error".  I'll try to find out why.
>>>>>>>>>
>>>>>>>>> Thanks for the tip,
>>>>>>>>>
>>>>>>>>> Alexandre
>>>>>>>>>
>>>>>>>>> Guillaume Sueur wrote:
>>>>>>>>>                                    
>>>>>>>>>                   
>>>>>>>>>> that's what tilecache_seed.py does.
>>>>>>>>>>
>>>>>>>>>> See http://tilecache.org/readme.html#seeding-your-tilecache
>>>>>>>>>>
>>>>>>>>>> Guillaume
>>>>>>>>>>
>>>>>>>>>> Alexandre Dube a écrit :
>>>>>>>>>>  
>>>>>>>>>>                                            
>>>>>>>>>>                     
>>>>>>>>>>> Hi Guillaume,
>>>>>>>>>>>
>>>>>>>>>>> I don't know what tileseed.py is.  What I would like to do is
>>>>>>>>>>> generate
>>>>>>>>>>> all tiles for all resolutions of my raster layer in
>>>>>>>>>>> tilecache.  Is
>>>>>>>>>>> there
>>>>>>>>>>> a way to do this ?
>>>>>>>>>>>
>>>>>>>>>>> Many thanks,
>>>>>>>>>>>
>>>>>>>>>>> Alexandre
>>>>>>>>>>>
>>>>>>>>>>> Guillaume Sueur wrote:
>>>>>>>>>>>                                                       
>>>>>>>>>>>                       
>>>>>>>>>>>> you mean the tileseed.py stuff ?
>>>>>>>>>>>>
>>>>>>>>>>>> Alexandre Dube a écrit :
>>>>>>>>>>>>  
>>>>>>>>>>>>                                                                 
>>>>>>>>>>>>                         
>>>>>>>>>>>>> Hi list,
>>>>>>>>>>>>>
>>>>>>>>>>>>>   Is there a way, using command line, to pre-generate all tiles
>>>>>>>>>>>>> of a
>>>>>>>>>>>>> layer in tilecache.cfg file ( with its resolutions and
>>>>>>>>>>>>> extent ) ?
>>>>>>>>>>>>>
>>>>>>>>>>>>>                                                            
>>>>>>>>>>>>>                       
>>>>>>>>>>>>>                           
>>>>>>>>>>>>                                                  
>>>>>>>>>>>>                     
>>>>>>>>>>>>                         
>>>>>>>>>>>                                                           
>>>>>>>>>>>                       
>>>>>>>>>                                       
>>>>>>>>>                   
>>>>>>>>                               
>>>>>>>>                 
>>>>>>>                       
>>>>>>>               
>>>>>>                 
>>>>>>             
>>>>>           
>>>>>           
>>>>       
>>>>         
>>>       


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Tilecache mailing list