[ka-Map-users] setting transparency for a layer

Paul Spencer pspencer at dmsolutions.ca
Tue Jan 10 13:37:28 EST 2006


Thorsten,

this is a tricky problem that has to do with the fact that IE does  
not display 24 bit png images with alpha transparency correctly.

The way you have set up your map file, ka-map will render the  
Wassertiefe layer as a separate set of tiles on top of your base  
layers.  The easiest solution is to not render transparent tiles in  
mapserver and let the browser apply transparency to the whole layer.   
In ka-map, you can achieve this effect by adding the following  
metadata to the first layer in any group:

"opacity" "50"

and remove the TRANSPARENCY 50 from the layer.

Cheers

Paul

NB: There is a known work around for this problem, often referred to  
as pngHack. It works by replacing the image source with a transparent  
gif and then applying a filter that loads the image using an activex  
component.  In the default startUp.js/screen.css in ka-map cvs, there  
is a css style that automagically applies this hack to images with a  
class of "png24".  Theoretically, we could detect TRANSPARENCY on a  
layer and somehow trigger this class to be added to the tiles as they  
are created.  Unfortunately, the practical side of this is a little  
trickier because how tiles are re-used affects how the hack works.   
Ultimately, the opacity metadata is the simplest solution in ka-map.


On 9-Jan-06, at 5:14 AM, <T.Hens at bjoernsen.de> <T.Hens at bjoernsen.de>  
wrote:

> Dear List,
> also the problem tranparency is already listed, i did not get a  
> solution for my problem. I have to draw a polygon shape with  
> transparency 50 over a raster dataset. In Chameleon it works fine  
> for FireFox and IE, but the same map file in ka-map causes problems  
> in IE: only the raster layer is visible, the 50% transparent  
> polygons are not visible.
>
> I tried to use gif output, but transparency of 50% did not work in  
> Firefox and IE, the polygons were drawn, but without transparency.
>
> I use the following settings in the Mapfile
> OUTPUTFORMAT
> NAME PNG
> DRIVER "GD/PNG"
> MIMETYPE "image/png"
> IMAGEMODE RGBA
> EXTENSION "png"
> FORMATOPTION "INTERLACE=ON"
> TRANSPARENT ON
> END
> ...
> LAYER
> NAME "Wassertiefe HQ 100"
> GROUP "Wassertiefe"
> STATUS ON
> DATA "wt/wt_hq100"
> TYPE POLYGON
> CLASSITEM "wtiefe"
> UNITS METERS
> SIZEUNITS PIXELS
> TOLERANCE 0
> TOLERANCEUNITS PIXELS
> TRANSPARENCY 50
> TEMPLATE "foo"
> METADATA
> "WMS_TITLE" "Wassertiefe HQ 100"
> "WMS_ABSTRACT" "Wassertiefe bei HQ 100, Abfluss 1200 m³/s"
> END
> END
> What can i do to get the polygons 50% transparent in IE and Firefox?
> Best regards,
> Thorsten
>
>
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+







More information about the ka-Map-users mailing list