1

I'm trying to change the direction of the vector automatically.

I'm looking for in a NetCDF file the variable wd, but the vectors are all directed down, as if it were null

follows the result of ncdump -h from the file and the sld that I am tuning in GeoServer 2.12.1

ncdum -h

Code 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>        
        <Transformation>
          <ogc:Function name="ras:RasterAsPointCollection">
            <ogc:Function name="parameter">
              <ogc:Literal>data</ogc:Literal>
            </ogc:Function>
            <!-- Activate the logic to recognize the emisphere -->
            <ogc:Function name="parameter">
              <ogc:Literal>emisphere</ogc:Literal>
              <ogc:Literal>True</ogc:Literal>
            </ogc:Function>
            <ogc:Function name="parameter">
              <ogc:Literal>interpolation</ogc:Literal>
              <ogc:Literal>InterpolationBilinear</ogc:Literal>
            </ogc:Function>
            <ogc:Function name="parameter">
              <ogc:Literal>scale</ogc:Literal>
              <ogc:Function name="Categorize">
                <ogc:Function name="env">
                  <ogc:Literal>wms_scale_denominator</ogc:Literal>
                </ogc:Function>                     
                <!-- this will generalize arrows -->
                <ogc:Literal>8</ogc:Literal>
                <ogc:Literal>50000</ogc:Literal>
                <ogc:Literal>4</ogc:Literal>
                <ogc:Literal>100000</ogc:Literal>
                <ogc:Literal>2</ogc:Literal>
                <ogc:Literal>500000</ogc:Literal>
                <ogc:Literal>1</ogc:Literal>
                <ogc:Literal>1000000</ogc:Literal>
                <ogc:Literal>0.2</ogc:Literal>
                <ogc:Literal>5000000</ogc:Literal>
                <ogc:Literal>0.1</ogc:Literal>
                <ogc:Literal>10000000</ogc:Literal>
                <ogc:Literal>0.05</ogc:Literal>
                <ogc:Literal>20000000</ogc:Literal>
                <ogc:Literal>0.02</ogc:Literal>
              </ogc:Function>
            </ogc:Function>
          </ogc:Function>
        </Transformation>              
        <Rule>                                       
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <!--<WellKnownName>windbarbs://default</WellKnownName>-->
                <WellKnownName>extshape://sarrow</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#000000</CssParameter>
                </Fill>               
                <Stroke>
                  <CssParameter name="stroke">#000000</CssParameter>
                  <CssParameter name="stroke-width">0.2</CssParameter>
                </Stroke>                           
              </Mark>
              <Size>12</Size>   
              <Rotation>                
                    <ogc:Literal>wd</ogc:Literal>               
              </Rotation>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
  • Could it simply be a difference in expected vs actual units, e.g., radians vs degrees? You could put the wd variable as a label in a text symbolizer to see its value. Other possibility, did you check in the geoserver layer panel what the actual name of the band is? If it's not "wd" but something else, you'd get a similar failure. – Andrea Aime Mar 22 '18 at 17:43
  • Hi Andrea, thanks for the feedback. Andrea on my band is like 'dir' I had placed wd, because I imagined that the sld would take the name of the variable itself. (I am new to geoserver and sld) I changed my rotation tag to: <Rotation> <ogc: Literal> dir </ ogc: Literal></ Rotation> The value of dir is in degrees. – Hugo Ferreira Mar 22 '18 at 19:07
1

If the band is named "dir" and it is in degrees, then the following change should do:

<Rotation>                
  <ogc:PropertyName>dir</ogc:PropertyName>               
</Rotation>

You might still have to account for differences in expected rotation direction (clockwise vs counterclockwise).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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