Skip to content

GSIP 130

Kevin Smith edited this page Jul 10, 2015 · 10 revisions

GSIP 130 - Extend Layer Groups to apply scale ranges to descendants

Overview

Extend the LayerGroupInfo interface and its implementations to store a range of scales for each layer the same way as is done for style.

Proposed By

Kevin Smith

Assigned to Release

The release that this proposal will be implemented for is 2.8.

State

Choose one of:

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

Motivation

The present way to control the visibility of a layer in a scale dependant way is to apply min and max scale denominator attributes to the rules within a style applied to it.

When constructing a complex layer group, the scale ranges of the sublayers will be interdependant in a way that makes more sense to keep track of at the layer group level (the upper bound of one is likely to be the lower bound of another). This would also reduce the need for the creation and maintenance of multiple styles that exist only to apply different scale ranges while otherwise being identical. A layer used several times with the same style in different layer groups could have different ranges to suite each group.

While making the change we can do so in a way allowing for future improvements without further API changes.

Proposal

API Change

Prior to this proposal LayerGroupInfo declares the following methods:

List<PublishedInfo> getLayers();
List<StyleInfo> getStyles();
List<LayerInfo> layers();
List<StyleInfo> styles();

The get variants return the internal lists of layers and styles for those layers in a 1-1 correspondance.

The methods without the get prefix return lists that have been filtered and which have flattened any descendant layer groups.

This proposal would add:

A new class ScaleRange with attributes maxDenominator and minDenominator with the same semantics as they have on the a GeoTools style Rule. It would also provide methods for intersecting scale ranges.

LayerGroup and its implementations would then be extended with two new methods.

List<Map<String, Object>> getVendorOption();
List<Map<String, Object>> vendorOptions();

With the same 1-1 mapping to layers that styles have.

GetMap and GetLegendGraphic requests would be extended with a new vendor parameter visibleScales that restricts the scale at which layers are visible. Obviously a client could do the scale calculation itself and adjust the layers list but allowing this to be offloaded to GeoServer would still be a convenience even without the integration with layer groups.

Example: layers=largeScale;smallScale&visbleScales=10000:100000;100000:1000000 Layer largeScale is visible from 1:10000 to 1:100000 and layer smallScale is visible from 1:100000 to 1:1000000.

Implementation

The LayerGroupHelper support class would be extended to process flatten the lists of maps, including intersecting scale ranges of descendant layer groups.

The KVP parsing of GetMap and GetLegendGraphic would be modified to do the filtering (Combining the LayerGroup specified scale visibility with any that were specified in the request) when they unpack the Layer Group into their respective Request objects.

In the initial implementation, only the visibleScales option would be handled when coming from a layer group. Implementing the others would be a later project.

Notes

  • ScaleRange might make more sense being put up stream in the GeoTools styling module as an aid in doing similar manipulations of scale visibility.
  • A more drastic change would be to replace the parallel lists with a single list of objects that reference the child, style, and options map. This would reduce the amount of logic being duplicated in LayerGroupHelper but would have more significant issues for backward compatibility.

Feedback

This section should contain feedback provided by PSC members who may have a problem with the proposal.

Backwards Compatibility

The default scale range if none are specified would be universal (0, Infinity), which would replicate the current behaviour.

Voting

  • Alessio Fabiani:
  • Andrea Aime:
  • Ben Caradoc Davies:
  • Christian Mueller:
  • Gabriel Roldan:
  • Jody Garnett:
  • Jukka Rahkonen:
  • Justin Deoliveira:
  • Phil Scadden:
  • Simone Giannecchini:

Links

Clone this wiki locally