Publishing a Style¶
In GeoServer, styles determine how your data will be visually represented on the map. By defining a style and linking it to a layer, you control the colors, line widths, fill patterns, and other visual elements that make your data both clear and visually appealing. This step is essential for presenting information in a way that’s easy to interpret and matches your project’s design requirements.
Step 1: Access Creation Page¶
Before you can create a style, you’ll first need to open the style creation interface in GeoServer.
-
In the left-hand menu, under the Data section, click Styles.
-
Click Add New Style.
-
The New Layer Group page will open.

Step 2: Create Style¶
Now that you’ve accessed the style creation interface, it’s time to define the basic properties and generate an initial style that you can later refine.
-
On the New Style page, enter the following details:
Field Value Name background Workspace manual Format SLD -
Under Generate a default style, select Line.
-
Click Generate... to automatically populate the style editor with a basic line style outline.
-
Press Apply to save the style. Once saved, additional interactive editing options will become available.

Step 3: Edit Style¶
With your base style created, you can now make adjustments to refine the layer’s appearance.
-
Go to the Publishing tab at the top of the page.
-
Enable the Default checkbox next to ne_110m_coastline.
-
Open the Layer Preview tab from the top of the page.
-
Modify the style by changing the stroke color to blue (#004eff) and adjusting the stroke-width.
<?xml version="1.0" encoding="ISO-8859-1"?> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <NamedLayer> <Name>background</Name> <UserStyle> <Title>Background</Title> <FeatureTypeStyle> <Rule> <Title>Background</Title> <PolygonSymbolizer> <Stroke> <CssParameter name="stroke">#004eff</CssParameter> <CssParameter name="stroke-width">0.25</CssParameter> </Stroke> </PolygonSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>
-
Click Apply to update the style and preview the changes in real time.
-
When satisfied with the result, click Save to finalize your edits.
