[Geoserver-users] wind direction arrows sld - how to filter out null values

On Mon, Feb 1, 2016 at 11:41 PM, Little, John (NRCan/RNCan) <
john.little@anonymised.com> wrote:

My SLD works!, However, my problem/question is… the geotiff contains null
values at the outter extents of the grid, outside of the area of interest.
I believe these null cell’s do in fact contain a value of
-3.4028234663853e+038. I’m wondering how (and where) would I apply this
filter to ensure these arrows are not drawn on the map?

See below

Here is my SLD:

<StyledLayerDescriptor version="1.0.0"
xmlns="http://www.opengis.net/sld&quot; xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:xlink="
http://www.w3.org/1999/xlink&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
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>

You should add the filter right here, working against the WDIR property,
something like the folowing
(warning, untested):

<ogc:Filter>
    <ogc:PropertyIsGreaterThan>
       <ogc:PropertyName>WDIR</ogc:PropertyName>
       <ogc:Literal>-360</ogc:Literal>
   </ogc:PropertyIsGreaterThan>
</ogc:Filter>

          <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:PropertyName>WDIR</ogc:PropertyName>
             </Rotation>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Hope this helps

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------