MapServer – Show Polygon Layer with Non-Transparent Border and Transparent Background in MapServer

mapservertransparency

In MapServer, I want to show a polygon WMS layer (watersheds). I want to show the boundaries (outlines) of the polygons as a non-transparent thick line. And I want to show the inside (fill) of the polygons with 50% transparency. Is this possible?

I tried to set OPACITY 50, but this changes the transparency of both the outline and the fill.
The second option I tried was to set TYPE line, but this shows the fill as complete transparent and the GetFeatureInfo no longer works by clicking inside the polygon.

What I would like to get, is:
The outlines of my polygons have 0% transparency.
The fill of my polygons has 50% transparency.

Best Answer

You should use two different STYLE blocks, one for the fill and one for the stroke:

CLASS
 STYLE
  OUTLINECOLOR r g b #stroke
  WIDTH 3
 END     
 STYLE
  COLOR r g b #fill
  OPACITY 50
 END
END

Ordering is important, you'll get different visual results if you swap the order of the STYLE blocks.