I try to visualize windspeed and -direction using geoserver's build-in windbarbs. Therefor I have a rasterlayer with two bands "u" and "v", representing the lat and lon vector forces of the wind.
I use the "ras:RasterAsPointCollection"-function to transform the raster to use the PointSymbolizer with which i'm able to plot the windbarbs with different windspeeds. However I wasn't successful trying to use the atan2 function within the Rotation.
The following code resulted in an error message
Filter Function problem for function atan2 argument #1 - expected type double
<Rotation>
<ogc:Function name = "atan2">
<ogc:Function name ="parameter">
<ogc:Literal>x</ogc:Literal>
<ogc:PropertyName>U</ogc:PropertyName>
</ogc:Function>
<ogc:Function name ="parameter">
<ogc:Literal>y</ogc:Literal>
<ogc:PropertyName>V</ogc:PropertyName>
</ogc:Function>
</ogc:Function>
</Rotation>
I checked the datatype of the layer (layer > click on layername > bottom of page, details of bands) which says
Real 64 bits
I've tried both "u" and "U" in PropertyName but I guess there's still something off with the syntax
Here is the full SLD
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld"
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
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" version="1.0.0">
<NamedLayer>
<Name>uv</Name>
<UserStyle>
<FeatureTypeStyle>
<Title>spd_dir</Title>
<Transformation>
<ogc:Function name="ras:RasterAsPointCollection">
<ogc:Function name="parameter">
<ogc:Literal>data</ogc:Literal>
</ogc:Function>
</ogc:Function>
</Transformation>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>
windbarbs://default(${sqrt((u*u) + (v*v))})[m/s]
</WellKnownName>
<Fill>
<CssParameter name="fill">
<ogc:Literal>#ffffff</ogc:Literal>
</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">0.1</CssParameter>
</Stroke>
</Mark>
<Rotation>
<ogc:Function name = "atan2">
<ogc:Function name ="parameter">
<ogc:Literal>x</ogc:Literal>
<ogc:PropertyName>U</ogc:PropertyName>
</ogc:Function>
<ogc:Function name ="parameter">
<ogc:Literal>y</ogc:Literal>
<ogc:PropertyName>V</ogc:PropertyName>
</ogc:Function>
</ogc:Function>
</Rotation>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>