1

How can I solve this problem with my SLD code for styles. When I do two scale ranges for a one lineSymbolizer to use another color or another thickness they appear twice in the legend of my viewer because I have to separate them into two rules. Can you do this in the same rule?

        <Title>Rua</Title>  



          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>TIPO_LOGRADOURO</ogc:PropertyName>
              <ogc:Literal>RUA</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>

      <MinScaleDenominator>17000</MinScaleDenominator>  
      <MaxScaleDenominator>36000</MaxScaleDenominator>

      <LineSymbolizer>

        <Stroke>
      <CssParameter name="stroke">#f6efc0</CssParameter>
      <CssParameter name="stroke-width">0.6</CssParameter>
    </Stroke>

      </LineSymbolizer>

     </Rule>


       <Title>Rua</Title>



         <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>TIPO_LOGRADOURO</ogc:PropertyName>
              <ogc:Literal>RUA</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>


      <MinScaleDenominator>8500</MinScaleDenominator>  
      <MaxScaleDenominator>17000</MaxScaleDenominator>

      <LineSymbolizer>

        <Stroke>
          <CssParameter name="stroke">#e098a9</CssParameter>
      <CssParameter name="stroke-width">1</CssParameter>
    </Stroke>  

      </LineSymbolizer>

The legend looks like

[Legenda]

  • Thanks for the reply Ian. But where do I have to make this request? In fact, he wanted to know if he could do that in SLD. See that RUA appears twice in the caption – Freire.fm Jun 11 at 17:21
1

You need to pass in the (optional) SCALE parameter - see the documentation for more details.

0

You could also try using a categorize or recode transform within a single rule to get the style values you need conditioned on geometry or environment attributes. https://docs.geoserver.org/stable/en/user/styling/sld/tipstricks/transformation-func.html

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.