transparency not working in dynamic layer

Lowell Filak lfilak at MEDINACO.ORG
Tue Jul 5 08:26:28 EDT 2005


The following message was sent by Mark Phillips <mbp at GEOMTECH.COM> on
Mon, 4 Jul 2005 19:28:38 -0500.

> Hi,
> 
> I'm using Perl mapscript to manually draw a rectangle on a map.  I'd
> like the rectangle to be transparent, so I'm drawing it in a layer
> that is already defined in the mapfile as follows:
> 
>     LAYER
>       NAME         RECT
>       STATUS       ON
>       TYPE         POLYGON
>       TRANSPARENCY 50
>       CLASS
>         COLOR         210 210 150
>         OUTLINECOLOR  0   0 0
>       END
>     END
> 
> The rectangle always comes out opaque, though.  Here's the relevant part
> of my perl script:
> 
>     $map = new mapscript::mapObj( ... );
>     ...
>     $img = $map->draw();
>     ...
>     $layerobj = $map->getLayerByName('RECT');
>     $layerobj->{status} = 1;
>     $rectobj = new mapscript::rectObj();
>     $rectobj->{minx} = -82.331429;
>     $rectobj->{maxx} = -82.323929;
>     $rectobj->{miny} =  35.508876;
>     $rectobj->{maxy} =  35.516376;
>     $rectobj->draw($map, $layerobj, $img, undef, "");
>     ...
>     $img->save($filename);
> 
> Does anyone know what I'm doing wrong?  I've seen references to
similar problems
> with transparency in dynamic layers in the list archives, but I
haven't seen
> a resolution.

Mark,

I'm not sure if you can perform a map->draw before you draw the
transparent layer and expect it to be transparent.
Can you use a shapeobj & addfeature to the layer before performing the draw?

Lowell



More information about the mapserver-users mailing list