A layer group is a container in which layers and other groups can be organized in a hierarchical structure. A layer group can be referred to by one name, this allows for simpler WMS requests, as the request need only refer to one layer as opposed to multiple individual layers.
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.
In case a layer is included in a any non single group it won’t be listed anymore in the flat layer list, although it will still be possible to include the same layer in different layer groups.
Edit Layer Group¶
To bring up the layer group edit page, click a layer group name. The initial fields allow you configure the name, title, abstract, workspace, bounds, projection and mode of the layer group. To automatically set bounding box, select the Generate Bounds button. You may also provide your own custom bounding box parameters. To select an appropriate projection click the Find button.
A layer group can consist of layers with dissimilar bounds and projections. GeoServer will automatically reproject all layers to the projection of the layer group.
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 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.
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.
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.
You can view layer groups in the Layer Preview section of the web admin.
Add a Layer Group¶
The buttons for adding and removing a layer group can be found at the top of the Layer Groups page.
To add a new layer group, select the “Add a new layer group” button. You will be prompted to name the layer group.
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.
Remove a layer group¶
To remove a layer group, click the check box next to the layer group. Multiple layer groups can be selected for batch removal. Click the remove selected layer group(s) link. You will be asked to confirm or cancel the deletion. Selecting OK successfully removes the layer group.