[OSM-dev] mod_tile meta-tiling looses png transparency

mandrake at linux.fjfi.cvut.cz mandrake at linux.fjfi.cvut.cz
Tue Jun 24 10:10:41 BST 2008


Quoting Jon Burgess <jburgess777 at googlemail.com>:

> 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
>
>

Hi,

thanks Jon! The change from png256 to png helped. I somehow presumed,  
that the image format requested by mod_tile is the same as what comes  
from mapnik's generate_tiles.py, which was wrong.
Thanks again!

mendrejk




More information about the dev mailing list