Developer’s Corner: Supporting Wind Barbs In GeoServer and GeoTools
Dear All,
in this post we would like to talk about the work we are doing to improve support in GeoServer for serving Meteorological and Oceanographic data, specifically the ability to render raster data for wind models using Wind Barbs.
When ingesting and serving MetOc models (raster data) for Wind data you are now already able to render them using an arrow symbology by concatenating:
- the gs:rasterAsFeatureCollection Rendering Transformation to transform the raster dataset into a series of vector points where the bands of the input raster data are the attributes
- a vector style to create arrows for each point with proper module and rotation controlled by the module and direction of the Wind data
With this approach you can obtain something like the following:
There are a few drawbacks in this approach which are trying to improve in GeoServer, namely:
- it is not uncommon to draw too many symbols depending on the resolution of the underlying data which makes the visualization slow and cluttered. It is possible to use the standard techniques in GeoServer to reduce the cluttering but this happens once you have generated the vector points with the gs:rasterAsFeatureCollection Rendering Transformation hence it is a slow process (think about collision detection and conflict resolution)
- meteorologists want Wind Barbs and not simple arrows
We are currently working to improve point 1, we will describe that work in a different post. As of point 2 we are going to provide native support for Wind Barbs by developing a new graphic factory for GeoServer (actually for its rendering engine which is developed using GeoTools) which would allow to render vector points a as Wind Barbs this way:
<WellKnownName>windbarbs://default(<ogc:PropertyName>speed</ogc:PropertyName>)[m/s]</WellKnownName>
which allows us to:
- extract the speed from the respective speed attribute (yes, we have renamed the underlying raster band to speed)
- specify the unit of measure of the speed. Note that Wind Barbs always deal with speed in knots. Therefore, specifying the input unit of measure allows the factory to do the proper conversion to knots.
rotation can be applied as usual for point vector symbologies. The full style can be found here below:
<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="gs:RasterAsPointCollection">
<ogc:Function name="parameter">
<ogc:Literal>data</ogc:Literal>
</ogc:Function>
</ogc:Function>
</Transformation>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>windbarbs://default(<ogc:PropertyName>speed</ogc:PropertyName>)[m/s]</WellKnownName>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
<Fill>
<CssParameter name="fill">
<ogc:Literal>#f5ffff</ogc:Literal>
</CssParameter>
</Fill>
</Mark>
<Size>8</Size>
<Rotation>
<ogc:PropertyName>direction</ogc:PropertyName>
</Rotation>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
notice the usage of the gs:RasterAsPointCollection Rendering Transformation to turn the raster into a series of vector points. This feature is being developed as we speak, it will be first available on the development series of GeoServer (2.6.x) and then will be backported to 2.5.x. More on the work that we are doing for improving the support for Meteorological and Oceanographic data will be reported in the next posts. It is worth mentioning that this work is being performed under our GeoSolutions Enterprise Services framework contract.
If you are interested in learning about how we can help you achieving your goals with our Open Source products and professional services, do not hesitate to contact us!
The GeoSolutions team,