GeoServer – Polygon Transparency Settings Using SLD Style File

colorgeoserverpolygonsldtransparency

I am trying to add transparency to a set of polygons (city bounds) within a .sld style file for OSM. Please see below:

no transparnecy

As you can see the city bounds are overlapping Montana State University. My goal is to have no fill or transparent fill for the city bounds. In this image I have it set to #00FFFFFF and GeoServer is not liking it as you can see.

Here is the SLD chunk for the polygon:

<sld:Name>Boundary</sld:Name>
<sld:Title>Boundary</sld:Title> 
<sld:PolygonSymbolizer>
    <sld:Fill> 
        <sld:CssParameter name="fill">#00FFFFFF</sld:CssParameter>
    </sld:Fill>
    <sld:Stroke>
        <sld:CssParameter name="stroke">#6a7c87</sld:CssParameter> 
        <sld:CssParameter name="stroke-width">0.5</sld:CssParameter>
        <sld:CssParameter name="stroke-linejoin">round</sld:CssParameter>
    </sld:Stroke> 

Best Answer

You will need to specify an opacity as a CssParameter

<sld:Fill> 
   <sld:CssParameter name="fill-opacity">0</sld:CssParameter>
</sld:Fill>