[mapserver-users] Problem with transparency overlays
Tony Frame
jaframe at net-yan.com
Sat Jan 31 08:55:41 PST 2009
If you're using IE6 you'll probably need to add 'alpha:true' as a layer
option to get the browser to handle transparent png images.
ie change .... {isBaseLayer:false});
to .... {isBaseLayer:false, alpha:true});
Regards
Tony
----- Original Message -----
From: "Alexandre Dube" <adube at mapgears.com>
To: "Rafael chacón" <rafaelchacon at gmail.com>
Cc: <mapserver-users at lists.osgeo.org>
Sent: Friday, 30 January, 2009 9:31 PM
Subject: Re: [mapserver-users] Problem with transparency overlays
> Hi Rafael,
>
> Here's what the doc has to say about the TRANSPARENT option in the MAP
> object :
>
> <<<
> TRANSPARENT [on|off]
>
> Use FORMATOPTION “TRANSPARENT=ON” in the /OUTPUTFORMAT/
> <http://mapserver.org/mapfile/outputformat.html#outputformat>
> declaration to specify if the output images should be transparent.
>
> Deprecated since version 4.6.
>
> >>>
>
> So you should use OUTPUTFORMAT, for example like this :
>
> <<<
> OUTPUTFORMAT
> NAME "agg"
> MIMETYPE "image/png"
> DRIVER AGG/PNG
> EXTENSION "png"
> IMAGEMODE RGBA
> TRANSPARENT ON
> FORMATOPTION "INTERLACE=OFF"
> END
> >>>
> (the above example uses the AGG driver)
>
> Then, in your Openlayers layer's definition, use this param :
> roads = new OpenLayers.Layer.MapServer( "Roads",
> "http://192.168.1.100/cgi-bin/mapserv?map=us_states.map",
> {layers: 'us_roads', map_imagetype: 'agg'}, {isBaseLayer:false});
>
> The "transparent" option has no effects on a Layer.MapServer. It would
> have on a Layer.WMS though.
>
> Be sure to look at the OUTPUTFORMAT documentation to pick the right image
> type you want to use.
>
> Hope this helps,
>
> Alexandre
>
> Rafael chacón wrote:
>> Hi, I'm having some trouble with transparency layers appear/disappear.
>> I'm working with MapServer and Openlayers... I want two layers to overlay
>> but when I choose to show one the other one hides... Here is some of my
>> code.... Thanks for the help :)
>>
>> Mapserver File:
>>
>> MAP
>> size 800 600
>> imagetype 'gif'
>> TRANSPARENT ON
>> imagecolor 0 0 255
>> extent -180 -90 180 90
>> SYMBOLSET "symbols"
>> PROJECTION
>> "init=epsg:4269"
>> END
>>
>> WEB
>> IMAGEPATH "/var/www/apache2-default/gis_tests/tmp/"
>> IMAGEURL "/apache2-default/gis_tests/tmp/"
>> TEMPLATE "empty.html"
>>
>> metadata
>> wms_title "us_states"
>> wms_srs "EPSG:4269"
>> end
>> end
>>
>>
>> _______
>>
>> OPenlayers:
>>
>> layer = new OpenLayers.Layer.MapServer( "Estados unidos",
>> "http://192.168.1.100/cgi-bin/mapserv?map=us_states.map",
>> {layers: 'us_states', 'format':'image/png'});
>> roads = new OpenLayers.Layer.MapServer( "Roads",
>> "http://192.168.1.100/cgi-bin/mapserv?map=us_states.map",
>> {layers: 'us_roads',transparent: 'true', 'format':'image/png'},
>> {isBaseLayer:false});
>> gps = new OpenLayers.Layer.MapServer( "GPS",
>> "http://192.168.1.100/cgi-bin/mapserv?map=us_states.map",
>> {layers: 'gps_points', transparent: 'true', 'format':'image/png' },
>> {isBaseLayer:false});
>>
>> roads.setVisibility(false);
>> gps.setVisibility(false);
>>
>>
>> --
>> Rafael Chacon,
>>
>> "El hombre es la medida de todas las cosas". Protagoras
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
More information about the MapServer-users
mailing list