Some data formats come with their own dedicated, domain-specific styling, for example AIXM, DGN or DWG data. For such data, you typically don’t want to define an SLD style: you just want to keep using the default styling, but you still want to use SLD to restrict the data to a specific range of map scales.

This article explains how you can do that by assigning an SLD style that only defines a scale range, without any symbolizer.

Defining an SLD with a scale range only

A regular SLD rule combines a scale range with one or more symbolizers that define the styling to apply within that range. If you leave out the symbolizer, and the SLD contains exactly one FeatureTypeStyle with exactly one Rule, the WMS server still gives any configured SLD layer factories the opportunity to handle the style first. Only if none of them does, it falls back to the default, domain-specific styling for the data, while still restricting it to the scale range defined by the rule:

Program: An SLD rule that only restricts the default styling to a scale range, without adding any styling of its own
<FeatureTypeStyle>
  <Rule>
    <Name>Scale range only</Name>
    <MinScaleDenominator>500000.0</MinScaleDenominator>
    <MaxScaleDenominator>1000000.0</MaxScaleDenominator>
  </Rule>
</FeatureTypeStyle>

MinScaleDenominator and MaxScaleDenominator are both optional, and default to 0 and unbounded respectively, just as in a regular SLD rule.

This fallback only applies to a style with a single FeatureTypeStyle containing a single rule and no symbolizer. As soon as you add a symbolizer, a second rule, or a second FeatureTypeStyle, the WMS server handles the SLD as a regular SLD style, matching the rules against the data as usual.

Assigning the style to your data

You assign a scale-range-only SLD style to your data in the same way as any other SLD style:

  1. Upload the .sld file containing the style shown in this SLD rule to LuciadFusion Studio. LuciadFusion automatically creates a Style resource from the file.

  2. If you haven’t done so already, add the data that you want to restrict to a LuciadFusion product.

  3. Open the product, and associate the uploaded style with the data in its style set. If you want to offer the style as a separate named style next to the default styling, add it as a new style set instead of replacing the default one.

For more background information on assigning styles to data in LuciadFusion Studio, see How to customize the styling of your data.

Effect on the WMS service

Once the style is assigned, the WMS layer for the data behaves as follows:

  • GetMap and GetFeatureInfo requests that use this style render and query the data using its regular, domain-specific styling, but only within the configured scale range. Outside that range, the layer renders nothing for this style.

  • The scale range is advertised in the WMS GetCapabilities response for the corresponding layer and style through its MinScaleDenominator/MaxScaleDenominator elements. WMS clients can therefore find out about the scale range up front, without having to issue a request first.

You can now apply SLD-based scale filtering for domain-specific data formats, without having to give up their built-in styling.

This scale range restriction, and its GetCapabilities advertisement, only apply to an SLD style that’s configured as a Style resource and assigned to a data entry in the LuciadFusion product, as described above.

If you instead supply the same empty-style SLD directly in a WMS request through the SLD or SLD_BODY parameter, the request still succeeds and uses the default styling - but the rule’s scale range isn’t honored: nothing restricts rendering to that scale range, and, because the server never sees the SLD ahead of the request, it can’t be advertised in GetCapabilities either.

For more information about SLD styling in general, see Styling data with OGC SLD. For examples of combining a scale range with explicit styling rules, see How to render only a raster outline outside a raster scale range and How to style roads.