Dear All, I have a 2-Rule SLD file, to be applied to a raster (see below).
The style is well applied in the GetMap request, but not in the GetLegendGraphic one. In fact, only the first rule is rendered, but not the second one. This is against what have been reported in the documentation: https://docs.geoserver.org/stable/en/user/services/wms/get_legend_graphic/index.html RULE - Optional - Rule of style to produce legend graphic for, if applicable. In the case that a style has multiple rules but no specific rule is selected, then the map server is obligated to produce a graphic that is representative of all of the rules of the style. If I request a GetLegendGraphic with: ...&rule=Data (the first rule, it works) ...&rule=Flags (the second rule, it works) but I'm not able to retrieve the legend formed by the full rules list. --------------------------------------- to workaround this issue I've tried to have 2 RasterSymbolizer in the same Rule. It fails, with the error message: "Unable to create a legend for this style, we need exactly 1 Symbolizer" while in the documentation is reported: ( https://docs.geoserver.org/latest/en/user/styling/sld/reference/rules.html) "A rule combines a filter with any number of symbolizers." and "<RasterSymbolizer> 0..N Specifies styling for raster data." --------------------------------------- Thanks in advance Davide Battista --------------------------------------- <?xml version="1.0" ?> <sld:StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld"> <sld:UserLayer> <sld:LayerFeatureConstraints> <sld:FeatureTypeConstraint/> </sld:LayerFeatureConstraints> <sld:UserStyle> <sld:Name>Drought Intensity (Annual) - Cropland</sld:Name> <sld:Title/> <sld:FeatureTypeStyle> <sld:Name/> <sld:Rule> <sld:Name>Data</sld:Name> <sld:RasterSymbolizer> <sld:Geometry> <ogc:PropertyName>grid</ogc:PropertyName> </sld:Geometry> <sld:Opacity>1</sld:Opacity> <sld:ColorMap type="intervals"> <sld:ColorMapEntry color="#c00000" label=" <25 (Extreme)" opacity="1.0" quantity="0.25"/> <sld:ColorMapEntry color="#ca6664" label=" 25 - 35 (Severe)" opacity="1.0" quantity="0.35"/> <sld:ColorMapEntry color="#ffff30" label=" 35 - 38 (Moderate)" opacity="1.0" quantity="0.38"/> <sld:ColorMapEntry color="#e2efda" label=" 38 - 42 (Mild)" opacity="1.0" quantity="0.42"/> <sld:ColorMapEntry color="#aad08e" label=" >=42 (None)" opacity="1.0" quantity="251"/> </sld:ColorMap> </sld:RasterSymbolizer> </sld:Rule> <sld:Rule> <sld:Name>Flags</sld:Name> <sld:RasterSymbolizer> <sld:Geometry> <ogc:PropertyName>grid</ogc:PropertyName> </sld:Geometry> <sld:Opacity>1</sld:Opacity> <sld:ColorMap type="values"> <!-- <sld:ColorMapEntry color="#ffffff" label=" off season" opacity="1.0" quantity="251"/> --> <sld:ColorMapEntry color="#000000" label=" insufficient data" opacity="1.0" quantity="252"/> <sld:ColorMapEntry color="#666666" label=" no season" opacity="1.0" quantity="253"/> <sld:ColorMapEntry color="#cccccc" label=" no cropland" opacity="1.0" quantity="254"/> <!-- <sld:ColorMapEntry color="#ffffff" label=" water" opacity="0.0" quantity="255"/> --> </sld:ColorMap> </sld:RasterSymbolizer> </sld:Rule> </sld:FeatureTypeStyle> </sld:UserStyle> </sld:UserLayer> </sld:StyledLayerDescriptor> ---------------------------------------
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users