4

I am serving a Wind as a point layer on GeoServer. In each point I have data:

  • wind speed [m/s] and
  • wind direction [degrees]

Currently I am using default style, but I would like to be able to change its representation to

Is it possible to do it with my data source and how can it be done?

2 Answers 2

3

From the GeoSolutions' blog the answer is yes. Much of the complexity the wind barbs example you link to is converting the velocity raster into points. You don't need any of that as you already have points with direction and speed.

THere isn't much documentation on windbarbs but basically you use the windbarbs:// prefix, and follow it with default(speed)[unit].

windbarbs://default(15)[kts]    

gives 15 wind intensity with knots unit of measure

windbarbs://default(9)[m/s]?hemisphere=s    

is 9 wind intensity with [m/s] unit of measure, in the south hemisphere

For full details you can study WindBarbsFactory. It looks like you can specify the speed in m/s, cm/s, km/h, mph and knots or any other unit that javax.measure.unit.UnitFormat can recognise.

Thus you can just plug speed and direction directly into the 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: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>
        <Rule>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>windbarbs://default(<ogc:PropertyName>speed</ogc:PropertyName>)[m/s]</WellKnownName>
                 <Fill>
                  <CssParameter name="fill">
                    <ogc:Literal>#f5ffff</ogc:Literal>
                  </CssParameter>
                </Fill>
                <Stroke>
                  <CssParameter name="stroke">#000000</CssParameter>
                  <CssParameter name="stroke-width">1</CssParameter>
                </Stroke>
              </Mark>
              <Size>8</Size>
              <Rotation>
                <ogc:PropertyName>direction</ogc:PropertyName>
              </Rotation>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
5
  • I am geting validation error on this: line 20: cvc-complex-type.2.4.d: Invalid content was found starting with element 'Fill'. No child element is expected at this point.
    – mycupoftea
    Commented Nov 7, 2017 at 12:15
  • does it work anyway?
    – Ian Turton
    Commented Nov 7, 2017 at 13:01
  • Fill should be above stroke, I'll fix it
    – Ian Turton
    Commented Nov 7, 2017 at 13:02
  • Sorry didnt know it can pass validation due to error. It does actually work! But I still need to test if drawings are correct! I still dont get, what does this SLD call so that it knows what kind of windbarb to draw? How is this defined?
    – mycupoftea
    Commented Nov 7, 2017 at 13:37
  • True, there is no validation error anymore! Thanks for fixing it and for additional explanation!
    – mycupoftea
    Commented Nov 7, 2017 at 13:55
0

The windbarbs source code has been restructured and is now at Windbarbs.

3
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 12, 2023 at 16:09
  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
    – Vince
    Commented May 12, 2023 at 16:28
  • I'm happy to improve the comment - what's the right way to say that a link in the accepted answer is broken and that I've provided an update?
    – Lance Berc
    Commented May 12, 2023 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.