Layer Groups

A layer group is a container in which layers and other layer groups can be organized in a hierarchical structure. A layer group can be referred to by a single name in WMS requests. This allows simpler requests, as one layer can be specified instead of multiple individual layers. A layer group also provides a consistent, fixed ordering of the layers it contains, and can specify alternate (non-default) styles for layers.

../../_images/data_layergroups.png

Layer Groups page

Layer Group modes

Layer group behaviour can be configured by setting its mode. There are 5 available values:

  • single: the layer group is exposed as a single layer with a name, acting as an alias for a list of layers. The layers are still showing up as top level entries in the WMS capabilities document (unless explicitly referred by a tree group).
  • opaque container: the layer group is exposed as a single layer with a name, acting as an alias for a list of layers. However, the layers and sub-groups contained in it won’t show up in the capabilities document (unless explicitly referred by a tree group) and won’t be available by themselves in WMS calls and in the WMS capabilities document, but only as part of the group.
  • named tree: the layer group can be referred to by one name, but also exposes its nested layers and groups in the capabilities document.
  • container tree: the layer group is exposed in the capabilities document, but does not have a name, making it impossible to render it on its own. This is called “containing category” in the WMS specification.
  • Earth Observation tree: a special type of group created to manage the WMS Earth Observation requirements. This group does not render its nested layers and groups, but only a “preview layer” called Root Layer. When this mode is chosen, a new field “Root Layer” will be exposed in the configuration UI.

If a layer is included in any non single mode group, it will no longer be listed in the flat layer list. It will still be possible to include the layer in other layer groups.

Layer Group Mode Named Contains Children Lists Children Details
Single named   no  
Opaque Container named yes no hides children
Named Tree named yes lists children  
Container Tree   yes lists children  
Earth Observation Tree named yes lists children has root layer

Edit a Layer Group

To view or edit a layer group, click the layer group name. A layer group configuration page will be displayed. The initial fields allow you to configure the name, title, abstract, workspace, bounds, projection and mode of the layer group. To automatically set the bounding box, select the Generate Bounds button or the Generate Bounds From CRS button to use the bounds defined in the CRS (if available). You may also provide your own custom bounding box extents. To select an appropriate projection click the Find button.

Note

A layer group can contain layers with dissimilar bounds and projections. GeoServer automatically reprojects all layers to the projection of the layer group.

../../_images/data_layergroups_edit.png
../../_images/data_layergroups_edit_table.png

Layer Groups Edit page

The table at the bottom of the page lists layers and groups contained within the current layer group. We refer to layers and layer groups as publishable elements. When a layer group is processed, the layers are rendered in the order provided, so the publishable elements at the bottom of list will be rendered last and will show on top of the other publishable elements.

A publishable element can be positioned higher or lower on this list by clicking the green up or down arrows, respectively, or can be simply dragged in the target position. The layer at the top of the list is the first one to be painted, the layer below it will be painted second, and so on, the last layer will be painted on top of all others (this is the so called “painter’s model”).

The Style column shows the style associated with each layer. To change the style associated with a layer, click the appropriate style link. A list of enabled styles will be displayed. Clicking on a style name reassigns the layer’s style.

../../_images/data_layergroups_edit_styles.png

Style editing for a layer within a layer group

To remove a publishable element from the layer group, select its button in the Remove column. You will now be prompted to confirm or cancel this deletion.

A layer can be added to the list by clicking the Add Layer… button at the top of the table. From the list of layers, select the layer to be added by clicking the layer name. The selected layer will be appended to the bottom of the publishable list.

../../_images/data_layergroups_add_layer.png

Dialog for adding a layer to a layer group

A layer group can be added by clicking the Add Layer Group… button at the top of the table. From the list of layer groups, select the layer group to be added by clicking its name. The selected group will be appended to the bottom of the publishable list.

../../_images/data_layergroups_add_layergroup.png

Dialog for adding a layer group to a layer group

A style group can be added by clicking the Add Style Group… button at the top of the table. From the list of styles, select the style group to be added by clicking its name. The selected style will be appended to the bottom of the publishable list.

../../_images/data_layergroups_add_stylegroup.png

Dialog for adding a style group to a layer group

You can view layer groups in the Layer Preview section of the web admin.

../../_images/data_layergroups_tasmania.png

Openlayers preview of the layer group “tasmania”

Note

By default, a layer group is queryable when at least a child layer is queryable. Uncheck “Queryable” box if you want to explicitly indicate that it is not queryable independently of how the child layers are configured.

Add a Layer Group

The buttons for adding and removing a layer group can be found at the top of the Layer Groups page.

../../_images/data_layergroups_add.png

Buttons to add or remove a layer group

To add a new layer group, select the “Add a new layer group” button. You will be prompted to name the layer group.

../../_images/data_layergroups_name.png

New layer group dialog

When finished, click Submit. You will be redirected to an empty layer group configuration page. Begin by adding layers by clicking the Add layer… button (described in the previous section). Once the layers are positioned accordingly, press Generate Bounds to automatically generate the bounding box and projection. You may also press the Generate Bounds From CRS button to use the CRS bounds (if available). Press Save to save the new layer group.

../../_images/data_layergroups_add_edit.png

New layer group configuration page

Remove a Layer Group

To remove a layer group, select it by clicking the checkbox next to the layer group. Multiple layer groups can be selected, or all can be selected by clicking the checkbox in the header. Click the Remove selected layer group(s) link. You will be asked to confirm or cancel the deletion. Selecting OK removes the selected layer group(s).

../../_images/data_layergroups_delete.png

Removing a layer group

Layer Group Keywords

Is possible to associate a layer group with some keywords that will be used to assist catalog searching.

../../_images/data_layergroups_keywords.png

Layer groups keywords editor

Layer groups keywords will no be merged with contained layers keywords but keywords of a layer group should be logically inherited by contained layers.

Previous: Layers