Create a style for a project layer

The display of features on the map and in the legend is defined by an SLD (Styled Layer Descriptor) file. This special XML schema can be adjusted as needed using the integrated editor.

Create a style for a project layer

 

To create a new SLD style or load an existing one, first click the button (1) “Load production SLD”. If a style already exists, it will be loaded and a preview of the legend will be generated (4).

Edit the style in the provided editor. The text is checked for correct syntax and some values, if missing, are added automatically when saving (2) (e.g. the layer name).

Note:
If you create multiple rules with filters and an additional rule without a filter, this last rule is automatically supplemented with the “Else” filter <ElseFilter/>. This filter is used to select features that do not match any of the other rules.

For a project layer to be displayed on the map, a style (SLD) must be defined. This is usually already the case if the project was created via import. If additional layers are added to the project afterwards, they do not have an SLD. If a layer has no SLD defined, everything is rendered in the default style (blue).

If the message “This SLD is applied to multiple layers” appears, the SLD with the name “nm_dev_nfs_tc_cluster.sld” in this example is also used in other projects. This means that if the style file is modified, the style will also change in other projects. The advantage is that a style only has to be defined once and can be reused.

If this is not desired, there is the option to rename the SLD. In effect, the file is saved under a different name. To do this, enter a new SLD name in field (5). When assigning a name, be sure to follow the format ******.sld so that the GeoServer does not generate error messages.

Afterwards, the layer (not the style) must be saved (3). Attention: the content of the editor disappears because it is a new file. Therefore, make sure to copy the style to the clipboard beforehand. After that, the style can be adjusted and saved as usual.