With SLD, you can define styling rules that apply within a specific scale range only. Each rule has an optional MinScaleDenominator and MaxScaleDenominator property to define this scale range. For raster data, a use case is the rendering of topographic maps; such maps are often only applicable within selected scale ranges.

The following example defines a styling rule that only renders raster data within scales ranging from 1:500000 to 1:1000000.

Program: Defining a styling rule to show raster data within the scale range [500k, 1M]
<Rule>
  <Name>Raster style</Name>
  <MinScaleDenominator>500000.0</MinScaleDenominator>
  <MaxScaleDenominator>1000000.0</MaxScaleDenominator>
  <RasterSymbolizer/>
</Rule>

Outside this scale range, it can be useful to show the outline of raster data: this makes it clear for the user that data is available there. To show such an outline, define styling rules with a PolygonSymbolizer: when you apply them to raster data, they render the outline of the raster.

To show the raster outline outside the scale range from the example, you must define two styling rules.

A first rule renders the outline when map users zoom out until they reach the scale 1:1000000 :

Program: Defining a styling rule to show the raster outline for scale 1M or higher
<Rule>
  <Name>Raster outline style zoomed out</Name>
  <MinScaleDenominator>1000000.0</MinScaleDenominator>
  <MaxScaleDenominator>INF</MaxScaleDenominator> <!-- can be left out; this is the default value -->
  <PolygonSymbolizer>
    <Stroke>
      <SvgParameter name="stroke">#ff00ff</SvgParameter>
      <SvgParameter name="stroke-width">3</SvgParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>

A second rule renders the outline when map users zoom in beyond scale 1:500000:

Program: Defining a styling rule to show the raster outline for scale 500k or lower
<Rule>
  <Name>Raster outline style zoomed in</Name>
  <MinScaleDenominator>0.0</MinScaleDenominator> <!-- can be left out; this is the default value -->
  <MaxScaleDenominator>500000.0</MaxScaleDenominator>
  <PolygonSymbolizer>
    <Stroke>
      <SvgParameter name="stroke">#ff00ff</SvgParameter>
      <SvgParameter name="stroke-width">3</SvgParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>

The SLD style with all raster styling rules

<?xml version='1.0' encoding='UTF-8'?>
<FeatureTypeStyle xmlns="http://www.opengis.net/se"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://www.opengis.net/se http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd"
                  version="1.1.0">
  <Name>Raster with scale range</Name>
  <Description>
    <Title>Raster style [500K, 1M]</Title>
    <Abstract>Renders raster data in scale range [500K, 1M]; outside this scale range,
      only the outline is rendered with a thick pink line.
    </Abstract>
  </Description>
  <Rule>
    <Name>Raster outline style zoomed out</Name>
    <MinScaleDenominator>1000000.0</MinScaleDenominator>
    <MaxScaleDenominator>INF</MaxScaleDenominator>
    <PolygonSymbolizer>
      <Stroke>
        <SvgParameter name="stroke">#ff00ff</SvgParameter>
        <SvgParameter name="stroke-width">3</SvgParameter>
      </Stroke>
    </PolygonSymbolizer>
  </Rule>
  <Rule>
    <Name>Raster style</Name>
    <MinScaleDenominator>500000.0</MinScaleDenominator>
    <MaxScaleDenominator>1000000.0</MaxScaleDenominator>
    <RasterSymbolizer/>
  </Rule>
  <Rule>
    <Name>Raster outline style zoomed in</Name>
    <MinScaleDenominator>0.0</MinScaleDenominator>
    <MaxScaleDenominator>500000.0</MaxScaleDenominator>
    <PolygonSymbolizer>
      <Stroke>
        <SvgParameter name="stroke">#ff00ff</SvgParameter>
        <SvgParameter name="stroke-width">3</SvgParameter>
      </Stroke>
    </PolygonSymbolizer>
  </Rule>
</FeatureTypeStyle>

See Styling data with OGC SLD for more information about using and applying OGC SLD/SE styling.