I am using GeoServer 2.19, and I have a wind coverage view from a grib file (uwnd,vwnd components), and I want it to become a wind speed raster layer.
When I preview it with a raster style, I realised that the color of raster just draw with only uwnd component, not the value of wind speed value(sqrt(uwnd^2 + vwnd^2)).
I saw rendering-transform can do what I want(something like value transform?!), but the example on it is not my needs. (I just need a raster layer of wind speed value, neither wind barbs nor wind arrows)
so I tried to edit it, then it doesn't worked.
My SLD style:
<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:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld ./StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>wind</Name>
<UserStyle>
<Title>wind</Title>
<FeatureTypeStyle>
<Transformation>
<ogc:Function name="Categorize">
<!-- Value to transform -->
<ogc:Function name="sqrt">
<ogc:Add>
<ogc:Mul>
<ogc:PropertyName>uwnd</ogc:PropertyName>
<ogc:PropertyName>uwnd</ogc:PropertyName>
</ogc:Mul>
<ogc:Mul>
<ogc:PropertyName>vwnd</ogc:PropertyName>
<ogc:PropertyName>vwnd</ogc:PropertyName>
</ogc:Mul>
</ogc:Add>
</ogc:Function>
<ogc:Literal>8</ogc:Literal>
<ogc:Literal>1.543333332</ogc:Literal>
<ogc:Literal>32</ogc:Literal>
</ogc:Function>
</Transformation>
<Rule>
<RasterSymbolizer>
<Size>
<ogc:Function name="Categorize">
<!-- Value to transform -->
<ogc:Function name="sqrt">
<ogc:Add>
<ogc:Mul>
<ogc:PropertyName>uwnd</ogc:PropertyName>
<ogc:PropertyName>uwnd</ogc:PropertyName>
</ogc:Mul>
<ogc:Mul>
<ogc:PropertyName>vwnd</ogc:PropertyName>
<ogc:PropertyName>vwnd</ogc:PropertyName>
</ogc:Mul>
</ogc:Add>
</ogc:Function>
<ogc:Literal>8</ogc:Literal>
<ogc:Literal>1.543333332</ogc:Literal>
<ogc:Literal>32</ogc:Literal>
</ogc:Function>
</Size>
<Graphic>
<ColorMap type="ramp">
<ColorMapEntry color="#f9f9f9" quantity="0" label="0m/s"/>
<ColorMapEntry color="#d860aa" quantity="2" label="2m/s"/>
<ColorMapEntry color="#9757cc" quantity="4" label="4m/s"/>
<ColorMapEntry color="#5774cc" quantity="6" label="6m/s"/>
<ColorMapEntry color="#57cccc" quantity="8" label="8m/s"/>
<ColorMapEntry color="#aacc57" quantity="10" label="10m/s"/>
<ColorMapEntry color="#ccc457" quantity="12" label="12m/s"/>
<ColorMapEntry color="#cc8b57" quantity="14" label="14m/s"/>
<ColorMapEntry color="#cc5757" quantity="16" label="16m/s"/>
<ColorMapEntry color="#775046" quantity="18" label="18m/s"/>
<ColorMapEntry color="#000000" quantity="20" label="20m/s"/>
</ColorMap>
</Graphic>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Error message:
code="internalError"Rendering process failed. Layers:wind-2020-11-23
Don't know how to handle the results of the transformation, the supported result types are FeatureCollection, GridCoverage2D and GridCoverage2DReader, but we got: class java.lang.String
Is anyone have experience of it?
RasterSymbolizer
makes no sense - there is noSize
orGraphic
element in the specification - docs.geoserver.org/latest/en/user/styling/sld/reference/…