Transparent pixmaps in Mapserver 4.4.1

Camden Daily cdaily at GMAIL.COM
Thu Jan 27 17:13:20 EST 2005


I'm having difficulties displaying pngs with transparent backgrounds
as symbols in 4.4.1.  I've read up on the bugs regarding this issue,
and the fix appears to be to add the line "TRANSPARENCY ALPHA" to the
layer containing the transparent symbols.

I draw my layer that contains my symbols using mapscript like this:

// create a temp layer to hold our points
$point_layer = ms_newLayerObj($map);
$point_layer->set("name", "markers");
$point_layer->set("type", MS_LAYER_POINT);
$point_layer->set("status", MS_DEFAULT);
// 1000 is the value used to set transparency to "alpha"
$point_layer->set("transparency", 1000);

// create a class and style for this layer
$point_class = ms_newClassObj($point_layer);
$point_style = ms_newStyleObj($point_class);
$point_symbol = $map->getSymbolByName("house");
$point_style->set("symbol", $point_symbol);
$point_style->set("size", 40);

I had to dig a little to find out that transparency of 1000 = alpha
(maybe need to define MS_ALPHA=1000 in mapscript?).  The layer
displays fine, but the symbol backgrounds aren't transparent.



More information about the mapserver-users mailing list