Layers & Styles
Understand how GeoServer separates data representation from visual rendering using Layers and Styles (SLD/SE).
Layer Management
A Layer is a named reference to a dataset within a Workspace. Each layer has a unique name within its workspace and is associated with at least one default style.
Creating a Layer
Layers are typically published automatically when you add a new feature type or coverage to a datastore. You can manage layer settings via the Web Admin interface or the REST API.
Styling with SLD/SE
Styles in GeoServer are defined using the Styled Layer Descriptor (SLD) standard or the more powerful Symbolizer Encoding (SE) extension. SLD is an XML-based language that controls symbology, labeling, and rendering.
css-in-style plugin.
<!-- Polygon Style for World Borders --> <StyledLayerDescriptor version="1.1.0" xmlns="http://www.opengis.net/sld"> <NamedLayer> <Name>world_borders_poly</Name> <UserStyle> <Title>World Borders Default</Title> <FeatureTypeStyle> <Rule> <Name>BasePolygon</Name> <PolygonSymbolizer> <Fill> <CssParameter name="fill">#888888</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">#ffffff</CssParameter> <CssParameter name="stroke-width">1.0</CssParameter> </Stroke> </PolygonSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>
Style Preview
Visualizing how styles apply to layers before publishing:
Layer-Style Associations
Each layer can have one default style and multiple available styles. Clients requesting the layer via WMS can specify a different style name to alter the rendering.
| Layer | Default Style | Available Styles | Format |
|---|---|---|---|
| world_borders | polygon | polygon, line, dem | SLD 1.1 |
| landcover_tiff | raster_color | raster_color, gray | SE |
| sensor_readings | point | point, point_cluster | SLD 1.1 |
Performance Considerations
-
•
Style Complexity: Complex SLD rules with nested functions can significantly increase render times. Use
ogc:PropertyIsBetweeninstead of multipleogc:PropertyIsGreaterThanOrEqualTorules. - • Tile Caching: Combine LayerGroups and use GeoWebCache (GWC) to pre-render styled tiles. This moves the style computation to build-time rather than request-time.
- • Label Placement: Labeling is the most expensive operation. Use "Labeling Mode" optimizations and limit labels to specific scales.