From the tilecache mailing list….

Hi Everyone,

Really appreciate all the replies…

  1. Installed Imaging-1.1.6.tar.gz (PIL).
[root@rupert-linux ~]# python
Python 2.3.4 (#1, Mar 10 2006, 06:12:09) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/lib/python2.3/site-packages',
'/usr/lib/python2.3/site-packages/PIL',
'/usr/lib/python2.3/site-packages/gtk-2.0']
>>>
  1. Modified test1.cfm
     41         var options = {
     42                         controls: [new OpenLayers.Control.MouseDefaults()]
     43                       };
     44
     45         map = new OpenLayers.Map( $('map'), options);
     46
     47         var layer_base = new OpenLayers.Layer.WMS(
     48                     "Base Layer",
     49                     "#request.mapserv_tile#",
     50                     {
     51                         map: '/home/map/beijing/new/wms.map',
     52                         layers: '#request.basemap_tile#',
     53                         format: 'image/png', 'transparent': 'false'
     54                     }
     55                     );
     56
     57         var layer_road = new OpenLayers.Layer.WMS(
     58                     "Road Layer",
     59                     "#request.mapserv_tile#",
     60                     {
     61                         map: '/home/map/beijing/new/wms.map',
     62                         layers: '#request.roads_tile#',
     63                         format: 'image/png', 'transparent': 'true'
     64                     },
     65                     {
     66                         reproject: false
     67                     }
     68                     );
     69
     70         map.addLayer(layer_base);
     71         layer_base.setIsBaseLayer(true);
     72
     73         layer_road.setIsBaseLayer(false);
     74         map.addLayer(layer_road);
  1. tilecache.cfg. Commented metaTile=true http://222.128.19.19/tilecache/tilecache.cfg
     47 [basemap]
     48 type=WMSLayer
     49 url=http://127.0.0.1/cgi-bin/mapserv?map=/home/map/beijing/new/wms.map
     50 layers=district,greens,major_river,minor_river
     51 #bbox=-180,-90,180,90
     52 #metaTile=true
     53 extension=png
     54
     55 [roads]
     56 type=WMSLayer
     57 url=http://127.0.0.1/cgi-bin/mapserv?map=/home/map/beijing/new/wms.map
     58 #layers=road4,road4label,road3,road3label,road2,road2label,road1,road1label,road11,road11label
     59 #bbox=116.1737,39.8211,116.5640,40.0799
     60 #maxresolution=1.40625
     61 #bbox=-180,-90,180,90
     62 layers=road1,road1label,road11,road11label
     63 extension=png
     64 #metaTile=true
  1. Modified wms.map http://222.128.19.19/tilecache/wms.map
OUTPUTFORMAT
     NAME png
     DRIVER "GD/PNG"
     MIMETYPE "image/png"
     IMAGEMODE RGB
     EXTENSION "png"
     FORMATOPTION "INTERLACE=OFF"
END
  1. Checked access_log. “transparent=true” exists…
    <br /> 192.168.1.150 - - [30/Mar/2007:13:46:26 +0800] "GET /tilecache/tilecache.py?MAP=%2Fhome%2Fmap%2Fbeijing%2Fnew%2Fwms.map&LAYERS=r<br /> oads&FORMAT=image%2Fpng&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=G<br /> etMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BB<br /> OX=116.334229%2C39.891357%<br /> 2C116.345215%2C39.902344&WIDTH=256&HEIGHT=256 HTTP/1.1" 200 14580<br />

Now, this is really weird. I have “transparent”: true in test1.cfm all the time. That didn’t worked.

For every test iteration i made, I always tried clearing the cache, removing the python compiled scripts, then restarting Apache just to get a clean state..

<br /> rm -Rf /usr/local/apache2/htdocs/tmp/*<br /> rm /wwwroot/tilecache/TileCache/*.pyc<br /> /etc/init.d/httpd restart<br />

Then I tried appending “transparent=true” to tilecache.cfg based on Eric’s suggestion…
That worked. Now I wonder why… Nevertheless, its working now. Again many thanks to everyone…

Rupert

On Fri, Mar 30, 2007 at 01:57:43PM +0800, Rupert de Guzman Jr wrote:

Hi Everyone,

Really appreciate all the replies…
Then I tried appending “transparent=true” to tilecache.cfg based on
Eric’s suggestion…
That worked. Now I wonder why… Nevertheless, its working now. Again
many thanks to everyone…

TileCache pays almost no attention to the URL: Only the BBOX and the layername matter. Anything else is simply ignored: so your transparency being set in OpenLayers actually has 0 affect.

The reason for this is that TileCache can only store one copy of an image. If the URL parameters modified the content, you could get an inconsistent cache.

This is ‘by design’, insofar as there is no obvious solution (other than to complain more loudly when TC Gets parameters it isn’t expecting, which is an outstanding FIXME in the code). The lack of error message is not by design, and I’m sorry you got bit by the poorly documented behavior.

Regards,

Christopher Schmidt
MetaCarta