[Mapserver-users] Setting transparency via CGI

Frank Warmerdam warmerdam at pobox.com
Mon Mar 31 11:42:51 EST 2003


Havard Tveite wrote:
> In my latest build of mapserver (3.7 dev 19 march 2003, gdal, gd2) it
> does not seem to be possible to set the layer TRANSPARENCY parameter via
> CGI.
> 
> Is this possible in the latest build? If not, is there a reason why?
> 
> I wanted the user to be able to supply a transparency value for a layer
> called "testlayer" from a menu, resulting in the following parameter
> being sent to mapserver:
> 
> map_testlayer_transparency=50
> 
> This can be very useful for orthofotos (e.g. satellite images or arial
> photograps), but can also be useful for vector layers.
> 
> In order for this parameter to have effect, the outputformat will have
> to have support for transparency.
> 
> 
> Something like the following could be added to the switch in
> mapfile.c - loadLayerString( ... )
> 
> case (TRANSPARENCY):
>     /* Should we check if transparency is supported by outputformat or
>        if transparency for this layer is already set??? */
>     msyystate = 2; msyystring = value;
>     if(getInteger(&(layer->transparency)) == -1) return;
>     break;

Havard,

I have committed this addition in 3.7 without really being handy enough to
test it.

Note that layer transparency is
a somewhat different concept than the transparency flag in the outputformat
structure.  The outputformat transparency indicates whether there will be
an alpha layer (RGB) or single transparent color in the output file.

The layer transparency is just used to mix a new layer into the existing
map image as it is being created and should work fine even if the outputformat
isn't transparent.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the mapserver-users mailing list