[mapserver-users] style level opacity issue

Huotari, John B (RCIS) John.Huotari at RCIS.com
Fri Nov 18 13:35:19 EST 2011


Now I'm really confused...  When I define the layer in the mapfile as follows it displays semi-transparent just fine using class-level opacity.

LAYER
	NAME "Field"
	TYPE polygon
	DATA "MAPFIELD"
	STATUS on
	PROJECTION
		"proj=longlat" "ellps=GRS80" "datum=NAD83"
	END
	CLASS
		NAME "FieldClass"
		STYLE
			SYMBOL 0
			WIDTH 1
			OUTLINECOLOR 0 0 0
			COLOR 0 255 0
			OPACITY 50
		END
	END
END

But when I add the layer to the map using mapscript as follows it is entirely opaque.

        Dim fieldLayer As New OSGeo.MapServer.layerObj(map)
        With fieldLayer
            .data = dataLocation & "MAPFIELD"
            .name = "Field"
            .type = MS_LAYER_TYPE.MS_LAYER_POLYGON
            .status = 1
            .setProjection("+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs")
            Dim fieldClass As New OSGeo.MapServer.classObj(fieldLayer)
            With fieldClass
                .name = "FieldClass"
                Dim fieldStyle As New OSGeo.MapServer.styleObj(fieldClass)
                With fieldStyle
                    .symbol = 0
                    .width = 1
                    .outlinecolor = New colorObj(0, 0, 0, 0)
                    .color = New colorObj(0, 255, 0, 0)
                    'set the opacity on the style
                    .opacity = 50
                End With
            End With
        End With

Does anyone see what I've done wrong?

I've created a trivial Visual Studio 2010 project which reproduces the behavior I could send to anyone who might have an interest in seeing it.  All zipped up including the MapServer binaries (from  MS4W version 3.0.3) and a little bit of data it is less than 2 MB in size.

Thank you,
John

-----Original Message-----
From: thomas bonfort [mailto:thomas.bonfort at gmail.com] 
Sent: Thursday, November 17, 2011 1:17 PM
To: Huotari, John B (RCIS)
Cc: lists at killface.org; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] style level opacity issue

I've just run a quick check and opacity on the style object works correctly. please come up with a self contained test case that reproduces your issue.

regards,
thomas

On Thu, Nov 17, 2011 at 18:15, Huotari, John B   (RCIS)
<John.Huotari at rcis.com> wrote:
> I’d likewise like to see an answer to this as I’ve thus far been 
> unable to make opacity work at the style level.  I’ve worked around 
> that by using the opacity at the layer level instead, which might be a 
> suitable solution in your situation.
>
>
>
> From: mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of 
> lists at killface.org
> Sent: Thursday, November 17, 2011 10:02 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] style level opacity issue
>
>
>
> I'm trying to render a single vector layer that has overlapping 
> polygons, but I cant seem to get the settings correct for what I want. 
> There are overlapping polygons on the layer, and I would like them to 
> each be drawn transparently so that I can see the overlapping regions. 
> However, no matter what I try I can't seem to get this effect and the 
> rendering will make the shapes draw over each other.
>
>
>
> I'm using Mapserver 6.0.1
>
>
>
> OUTPUTFORMAT
>
> NAME "png"
>
> DRIVER AGG/PNG
>
> MIMETYPE "image/pngt"
>
> IMAGEMODE RGBA
>
> EXTENSION "png"
>
> FORMATOPTION "GAMMA=1.0"
>
> TRANSPARENT TRUE
>
> END
>
>
>
> I have a very simple class for my layer
>
>   CLASS
>
>   STYLE
>
> OPACITY 25
>
> COLOR [color]
>
> OUTLINECOLOR -1 -1 -1
>
> ANTIALIAS TRUE
>
> END
>
>   LABEL
>
> COLOR  0 0 255
>
> OUTLINECOLOR 250 250 250
>
> OUTLINEWIDTH 3
>
> FONT stMYFont
>
> TYPE truetype
>
> SIZE 9
>
> POSITION AUTO
>
> PARTIALS FALSE
>
> MINFEATURESIZE AUTO
>
> END
>
>  END
>
>
>
> _______________________________________________
> 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