Select to view content in your preferred language

Expose styles on WMSSublayer

120
0
a week ago
Status: Open
Labels (1)
SebastianFrey1
New Contributor II

Expose styles for WMS sublayers on the WMSSublayer class as property.

const layer = new WMSLayer({ url: "..." });
const sublayer = layer.sublayers.at(0);

const styles = sublayer.styles; // access styles

Currently it's impossible to access styles of WMS sublayers through WMSSublayer class.

Using different styles provided by a WMS layer, requires hacky workarounds like monkey patching WMS layer class, which involves relying on internal, undocumented interfaces. Other workarounds may be an additional GetCapabilities requests or writing some fancy request interceptors. All those attempts do not scale.

Having direct access to styles on the WMSSublayer class, would allow applications to leverage different styles  for differen sublayers provided by a WMS layer using the customLayerParameters.

Thinking ahead, the WMSSublayer class might provide a direct interface to set a style, so applications would not have to rely on customLayerParameters from the WMSLayer class:

sublayer.style = 'default'; // sets the default style
sublayer.style = sublayer.styles[1]; // sets the first style from the styles list


Setting the style on a sublayer, would than trigger a new GetMap-Request.

Tags (3)