The last part was very simple. Next, let's style our administrative boundaries. From that layer, we only need our study area visualized with a dashed outline:
- Create a new style, and name it appropriately.
- Choose our workspace as Workspace; as this style will use an attribute from a layer, it won't be applicable to other layers.
- Generate a default polygon style.
- Save the template with the Submit button, open it again, and preview it on the administrative boundaries layer.
- Remove the <Fill> element and its content from the SLD document, as we don't need a fill. Don't forget to remove the closing tag (</Fill>).
- Add a third <CssParameter> element to the <Stroke> element of the style. It should define a dash, which can be achieved by using the name="stroke-dasharray" attribute. The dash array is a set of numbers separated by whitespaces. The first number describes the first dash's width in pixels, the second number is the first space's width, and so on:
<CssParameter name="stroke-dasharray">5 5</CssParameter>
- Filter the layer to only show our study area. This is a simple comparison, which needs an <ogc:Filter> element, an <ogc:PropertyIsEqualTo> element in it, a column name in an <ogc:PropertyName> element, and a value in an <ogc:Literal> element. We can put the code together by correct nesting, and get something similar to the following:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>name_1</ogc:PropertyName>
<ogc:Literal>Baranya</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
- Save the style, and declare it as the default style for the administrative boundaries layer.
We used some parameters that we have not not discussed before. You must be wondering how should you know the exact parameters to use in this case. The answer is very simple: you shouldn't. You can read out the parameters GeoServer can accept for different SLD elements from its SLD reference available at http://docs.geoserver.org/stable/en/user/styling/sld/reference/index.html.