[OSM-dev] mod_tile meta-tiling looses png transparency
Jon Burgess
jburgess777 at googlemail.com
Mon Jun 23 23:13:50 BST 2008
On Mon, 2008-06-23 at 22:09 +0200, mandrake at linux.fjfi.cvut.cz wrote:
> Hi all,
>
> I'm having a problem with mod_tile. I'm using it together with Mapnik
> to render an overlay map, so I need a transparent background in tiles.
> Mapnik does this just fine by setting attribute bgcolor="transparent"
> in osm.xml file. However, mod_tile groups the mapnik tiles into a
> .meta file and the transparency gets lost there. When I use
> convert_meta to unpack the meta file, the background is black.
> Somebody had the same problem here either,
> http://www.nabble.com/layer-transperancy-td16639745.html
> but the thread seems to be dead already with no solution.
> Could somebody please look at it? Hope it is not too complicated to fix.
The problem is with the Mapnik code that does the conversion to 256
colours. The discards the alpha channel (see include/mapnik/octree.hpp).
You can fix this by using the PNGA output instead. Edit gen_tile.cpp in
mod_tile and change the two references of png256 to png.
> I tried to override the problem by swithing the meta-tiling off by
> commenting out the
> #define METATILE (8)
> line in render_config.h. Separate png files are actually good enough
> to me since my overlay is quite simple. But I run into few compiling
> problems, which I was unable to fix.
> Thanks for any advice or fix!
I've submitted a bunch of changes to SVN which allow the code to be
compiled and run in non-meta tile mode. This does not make any
difference to the transparency issue. If you update the METATILE value
then you need to be careful to recompile and reinstall both the render
daemon and Apache module.
The changes also move the map style, font and plugin locations to the
render_config.h file so there should be less need to edit any other file
when configuring the module from now on.
Jon
More information about the dev
mailing list