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.

Layer Group modes

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

  • single: the layer group is exposed as a single layer with a name.
  • 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.

../../_images/data_layergroups.png

Layer Groups page

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. 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. 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

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”

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. 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