Styles
Default Styles
For each type, GeoServer has default style that is used.
If we look at our Waterways layer, we see it is gray (the default polygon style).
We’d like to make this blue.
Create a Style
1. Click Styles on the left menu
2. Click the “Add new style” link
3. For name, enter ‘WaterStyle’. For Workspace, select postgis.
4. In “Copy from existing style” dropdown, select green
5. Click the “copy” link to the right of the dropdown
6. As seen below, this loads the existing ‘green’ style into the style editor. We will use this to create our WaterStyle blue.
Copy an Existing Style
Now that we have loaded the ‘green’ style to use as our template, we will update it to blue. To do so,
1. Update the required lines, as shown below:
2. Click ‘Validate’ to check for errors. If no errors, click the Save button. Your new Style, “Waterways” should now appear in the Styles list.
Apply Style
1. Click the Layers button in the left menu
2. Select the waterways layer
3. In the Publishing tab, select postgis:WaterStyle from the Default Style dropsown
4. On select, we should see the thumbnail reflect the blue color we chose above
5. Click the Save button.
If we now preview our layer in Layer Preview, our layer is now blue.