In previous modules the style for a layer was configured by uploading an existing SLD. In this section the task of creating a new SLD document from scratch will be covered.
From the Welcome Page navigate to Config ‣ Data ‣ Style ‣ New.
Enter “bus_stops_style” in the text field and click New
Creating a new style
In the SLD Editor enter in the following XML:
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink">
<NamedLayer>
<Name>bus_stops</Name>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<PointSymbolizer>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Creating a new SLD with the style editor
Note
The above SLD is very basic. The thing to note is the <PointSymbolizer> element. In SLD a Symbolizer is the fundamental unit of styling. It specifies aspects of a style such as color, line width, labeling, and much more.
Click Submit to add the new SLD, then Apply and Save changes.
Using skills learned in the geoserver.basics module, modify the default style of the bay_area_bus_stops feature type to the newly created bus_stops_style.
Changing the default style of the bay_area_bus_stops feature type
Use the Map Preview to preview the new style.
Previewing the bay_area_bus_stops layer with the bus_stops_style applied
At this point a new SLD has been successfully created from scratch. The next section will focus on adding to this very basic SLD to add some more interesting styling.