Skip to content

GSIP 161

Torben Barsballe edited this page Jul 11, 2017 · 43 revisions

GSIP 161 - Style Based Layer Groups

Overview

Extend the LayerGroup model to enable defining a LayerGroup by referencing a style which uses one or more NamedLayers. This functionality "exists" currently when making WMS requests and referencing external styles using the SLD parameter. This GSIP proposes to promote this capability to "1st class citizenship" by adding a new type of LayerGroup entry that delegates to the Style to get the details on the layers included.

Proposed By

Torben Barsballe, David Vick

Assigned to Release

This proposal is for GeoServer 2.12-beta.

State

  • Under Discussion
  • In Progress
  • Completed
  • Rejected
  • Deferred

Motivation

SLD provides the ability to reference multiple layers from a single GeoServer using NamedLayers. While this is currently supported in GeoServer by using an external style in your WMS request, tying this functionality into the GeoServer WMS layer handling makes it more accessible, and allows us to reference additional layers in the WMS request alongside those referenced by such an SLD.

Additionally, this feature would provide an avenue for supporting the "sources" property of a MapBox style, thereby making GeoServer's MapBox Style extension more complete.

Proposal

  1. Add a new type of LayerGroup entry that delegates to the Style to get the details on the layers included.

    1.1. Create a new class extending PublishedInfo, called "StyleGroupInfo", which is intended to be a member of a LayerGroupInfo. This class will act as a marker, indicating that the contained layers will be provided by the associated style. Instances of StyleGroupInfo will not be stored as catalog objects (similar to LegendInfo). This also means that standalone instances of this class will not exist; they will only exist as members of a layer group. If no style is associated with an instance of StyleGroupInfo, then it will behave as an empty layer group.

    Given that all configuration is stored in the style, only a single instance of StyleGroupInfo among all layer groups will be necessary.

    Any number of Style Groups are permissible in a layer group.

    The StyleGroupInfo implementation of the PublishedInfo interface will be more similar to LayerGroupInfo than LayerInfo, except that it will not have contents (layers or styles). Namely, getType() will return PublishedType.GROUP. Methods such as setMetadataLinks will necessarily have no effect, since StyleGroupInfo will not be stored in the catalog.

    1.2. Add support for StyleGroupInfo to the layergroups REST API endpoint, e.g.

    PUT

       <layerGroup>
         <name>nyc</name>
         <layers>
           <styleGroup></styleGroup>
           <layer>parks</layer>
         </layers>
         <styles>
           <style>roads_style</style>
           <style>polygon</style>
         </styles>
       </layerGroup>
    

    1.3. Add support for StyleGroupInfo to the Layer Groups page in the Web UI: Add an "Add Style Group..." button after the existing "Add Layer..." and "Add Layer Group..." buttons. Rather than bringing up a dialog, this button will just add a style group to the layers list. The text "Style Group" (italicized, to differentiate it from a proper layer name) will show up under the Layer column. A null or default style will be equivalent to no style, and will show the text "Choose Style..." in the Style column.

    Also add an (i) informational popup describing what a StyleGroupInfo is and how it works.

  2. Make the necessary changes to GeoServer WMS to support this new collection of layers.

    2.1 Add logic to GetMapKvpRequestReader.java and GetMapXmlReader.java to handle Layer Groups being defined by a Style parameter. Current code is shown below.

     // ok, parse the styles parameter in isolation
     if (styleNameList.size() > 0) {
         List<Style> parseStyles = parseStyles(styleNameList);
         getMap.setStyles(parseStyles);
     }
    

    After getting the list of styles add a method to process the styles, adding MapLayerInfo and Style to the WMS request for each NamedLayer.

  3. Add support for this new functionality to the GeoServer style editor

    Add a "Style Group" option to the select preview layer dialog, which uses the WMS external SLD parameter to preview a style defining multiple named layers. This is technically entirely independent of the work necessary to add "Style Group" support, but will allow previewing styles as if they were being used as a StyleGroup or an external style.

Backwards Compatibility

This change is additive-only, so there should be no backwards compatibility concerns.

Feedback

Voting

Project Steering Committee:

  • Alessio Fabiani:
  • Andrea Aime:
  • Ben Caradoc-Davies:
  • Brad Hards:
  • Christian Mueller:
  • Ian Turton:
  • Jody Garnett:
  • Jukka Rahkonen:
  • Kevin Smith:
  • Simone Giannecchini:

Links

Clone this wiki locally