.. _sld_reference_layers: Layers ====== An SLD document contains a sequence of layer definitions indicating the layers to be styled. Each layer definition is either a **NamedLayer** reference or a supplied **UserLayer**. NamedLayer ---------- A **NamedLayer** specifies an existing layer to be styled, and the styling to apply to it. The styling may be any combination of catalog styles and explicitly-defined styles. If no style is specified, the default style for the layer is used. The ```` element contains the following elements: .. list-table:: :widths: 25 15 60 * - **Tag** - **Required?** - **Description** * - ```` - Yes - The name of the layer to be styled. (Ignored in catalog styles.) * - ```` - No - The description for the layer. * - ```` - 0..N - The name of a catalog style to apply to the layer. * - ```` - 0..N - The definition of a style to apply to the layer. See :ref:`sld_reference_styles` UserLayer --------- A **UserLayer** defines a new layer to be styled, and the styling to apply to it. The data for the layer is provided directly in the layer definition using the ```` element. Since the layer is not known to the server, the styling must be explicitly specified as well. The ```` element contains the following elements: .. list-table:: :widths: 25 15 60 * - **Tag** - **Required?** - **Description** * - ```` - No - The name for the layer being defined * - ```` - No - The description for the layer * - ```` - No - One or more feature collections providing the layer data, specified using GML. * - ```` - 1..N - The definition of the style(s) to use for the layer. See :ref:`sld_reference_styles` A common use is to define a geometry to be rendered to indicate an Area Of Interest. .. _sld_reference_inlinefeature: InlineFeature ------------- An **InlineFeature** element contains data defining a layer to be styled. The element contains one or more ```` elements defining the data. Each Feature Collection can contain any number of ```` elements, each containing a feature specified using GML markup. The features can contain any type of geometry (point, line or polygon, and collections of these). They may also contain scalar-valued attributes, which can be useful for labelling. Example ^^^^^^^ The following style specifies a named layer using the default style, and a user-defined layer with inline data and styling. It displays the US States layer, with a labelled red box surrounding the Pacific NW. .. code-block:: xml usa:states Inline -127.0,51.0 -110.0,51.0 -110.0,41.0 -127.0,41.0 -127.0,51.0 Pacific NW #FF0000 2 title #FF0000