0

When a SLD have a dynamic fill color or dynamic stroke color, then the title is not displayed in the Legend when a legend is requested from Geoserver.

See example below:

enter image description here

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:se="http://www.opengis.net/se" xmlns:ogc="http://www.opengis.net/ogc" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <NamedLayer>
        <se:Name>prop_land_use</se:Name>
        <UserStyle>
            <se:Name>prop_land_use</se:Name>
            <se:FeatureTypeStyle>
                <se:Rule>
                    <se:Name>default</se:Name>
                    <se:Description>
                        <se:Title>Property Land Use</se:Title>
                    </se:Description>
                    <se:MinScaleDenominator>0.0</se:MinScaleDenominator>
                    <se:MaxScaleDenominator>300000.0</se:MaxScaleDenominator>
                    <se:PolygonSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
                        <se:Fill>
                            <se:SvgParameter name="fill">
                                <ogc:PropertyName>lnduse_clr</ogc:PropertyName>
                            </se:SvgParameter>
                            <se:SvgParameter name="fill-opacity">0.1</se:SvgParameter>
                        </se:Fill>
                        <se:Stroke>
                            <se:SvgParameter name="stroke">
                                <ogc:PropertyName>lnduse_clr</ogc:PropertyName>
                            </se:SvgParameter>
                            <se:SvgParameter name="stroke-width">0.2</se:SvgParameter>
                            <se:SvgParameter name="stroke-linecap">
                                <ogc:Literal>round</ogc:Literal>
                            </se:SvgParameter>
                            <se:SvgParameter name="stroke-linejoin">
                                <ogc:Literal>round</ogc:Literal>
                            </se:SvgParameter>
                        </se:Stroke>
                    </se:PolygonSymbolizer>
                </se:Rule>
            </se:FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>
Skalla
  • 31
  • 3
  • 1
    @IanTurton - For **se** it is in correct place as taken from QGIS. For **sld** it should be as you mentioned. In fact, this was not the problem. I actually figured it out. The call to GetLegendGraphic needs to pass **forceLabels=on** otherwise styles with only one rule will omit the title. [link](https://docs.geoserver.org/latest/en/user/services/wms/get_legend_graphic/index.html#controlling-legend-appearance-with-legend-options) – Skalla Feb 18 '22 at 09:26
  • @ian-turton See the child elements under: https://schemas.liquid-technologies.com/OpenGis/se/1.1.0/description1.html You will see that Title needs to be under Description for se – Skalla Feb 18 '22 at 10:23

0 Answers0