2

I am new to GeoServer.

I am trying to add a scale range to a layer that I am serving as a WMS. I want the layer to only be displayed between 1:30,000 and 1:1,000,000. I am using the max/min scale denominators in the SLD but am not having much luck. It works if I have just one scale denominator, but not if I introduce a second one to create a range.

Current SLD below:

      <NamedLayer>
<Name>grid</Name>
<UserStyle>
  <FeatureTypeStyle>
    <Rule>
      <MinScaleDenominator>1000000</MinScaleDenominator>
      <PolygonSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#000000</CssParameter>
          <CssParameter name="stroke-width">0.2</CssParameter>
        </Stroke>
      </PolygonSymbolizer>
    </Rule>
    <Rule>
      <MaxScaleDenominator>300000</MaxScaleDenominator>
      <PolygonSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#e32222</CssParameter>
          <CssParameter name="stroke-width">0.2</CssParameter>
        </Stroke>
      </PolygonSymbolizer>
    </Rule>
   </FeatureTypeStyle>
</UserStyle>

This code currently does the reverse of what I am trying to achieve. The layer is displayed beyond the two scales not between them.

5

Below SLD code works for scale range:

       <NamedLayer>
<Name>grid</Name>
<UserStyle>
  <FeatureTypeStyle>
    <Rule>
      <MinScaleDenominator>300000</MinScaleDenominator>
      <MaxScaleDenominator>1000000</MaxScaleDenominator>
      <PolygonSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#000000</CssParameter>
          <CssParameter name="stroke-width">0.2</CssParameter>
        </Stroke>
      </PolygonSymbolizer>
    </Rule>
   </FeatureTypeStyle>
</UserStyle>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.