The most important function of a web map server is the ability to style and render data. This section covers the task of adding a new style to GeoServer and configuring the default style for a particular layer.
From the GeoServer Welcome Page navigate to Config ‣ Data ‣ Style.
Adding a new style
Click New
Adding a new style
Enter “coastline_style” in the text field and click New.
Specifying style name
Scroll to the bottom of the Style Editor page and click Browse.
Navigate to the workshop data/bayarea directory, select the bay_area_coastline.sld file, and click Upload.
Locating an SLD file
Uploading a new style
Note
In GeoServer, styles are represented via SLD (Styled Layer Descriptor) documents. SLD is an XML format for specifying the symbolization of a layer.
SLD editor
Note
When an SLD document is uploaded the contents are shown in the text editor. The editor can be used to edit the contents of the SLD directly.
Add the new style by clicking Submit, followed by Apply, and finally Save.
From the Config page navigate to Data ‣ FeatureTypes. Select bay_area_coastline_shp:bay_area_coastline` from the drop down and click Edit.
Editing a feature type
On the Feature Type Editor page set the Style by selecting coastline_style from the drop down.
Changing a feature type style
Note
Setting the default style allows that style to be used implicitly when no style is specified in a map request.
Scroll to the bottom of the page. Submit, Apply, and Save.
Repeat steps 1 through 3 from the previous module to view the bay_area_coastline layer in the Map Preview.
![]()
Previewing a style change
That concludes the basics module. At this point the tasks of adding and styling data have been successfully completed. In the next modules these core skills will be built upon to add more data and perform more complex styling.