[Geoserver-users] Re: Wind Barbs, Contouring, and SLD

Hi Bryce,
we had a similar problem here...At the end what we have done to render
wind arrows was:

1) Creating a Shapefile containing a set of points describing module
and rotation (computed by U and V components) for each arrow (with LAT
LON coordinates associated of course)

2) Building an SLD that drows an arrow with length and color
proportional to the module and the same rotation angle.

We built a software for automating the overall procedure.

The final SLD is quite big but the result is not bad.
Follows a little piece of the resulting SLD. as you can see the main
problem is that because it's not possible to use the shape property
values directly, we had to subdivide modules and directions into
categories. The software we made automatically writes the set of rules
for each direction every module category.
In the example below we have a rule each 2 direction degrees for each
module category.

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld&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;&gt;
<NamedLayer>
<Name>Wind Properties</Name>
<UserStyle>
<Name>Default Styler</Name>
<Title>Default Styler</Title>
<Abstract></Abstract>
<FeatureTypeStyle>
<FeatureTypeName>Feature</FeatureTypeName>

<!--
*
*
* Category 1: module [0.0 - 1.9999]
*
*
-->
<Rule>
<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:And>
<ogc:PropertyIsBetween>
<ogc:PropertyName>module</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>0.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>1.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
<ogc:PropertyIsBetween>
<ogc:PropertyName>direction</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>0.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>2.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:And>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>arrow</WellKnownName>
<Fill>
<CssParameter name="fill">#00FFFF</CssParameter>
</Fill>
</Mark>
<Opacity>
<ogc:Literal>1.0</ogc:Literal>
</Opacity>
<Size>
<ogc:Literal>7.5</ogc:Literal>
</Size>
<Rotation>
<ogc:Literal>1.0</ogc:Literal>
</Rotation>
</Graphic>
</PointSymbolizer>
</Rule>

<Rule>
<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:And>
<ogc:PropertyIsBetween>
<ogc:PropertyName>module</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>0.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>1.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
<ogc:PropertyIsBetween>
<ogc:PropertyName>direction</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>3.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>4.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:And>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>arrow</WellKnownName>
<Fill>
<CssParameter name="fill">#00FFFF</CssParameter>
</Fill>
</Mark>
<Opacity>
<ogc:Literal>1.0</ogc:Literal>
</Opacity>
<Size>
<ogc:Literal>7.5</ogc:Literal>
</Size>
<Rotation>
<ogc:Literal>3.5</ogc:Literal>
</Rotation>
</Graphic>
</PointSymbolizer>
</Rule>

<Rule>
<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:And>
<ogc:PropertyIsBetween>
<ogc:PropertyName>module</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>0.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>1.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
<ogc:PropertyIsBetween>
<ogc:PropertyName>direction</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>5.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>6.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:And>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>arrow</WellKnownName>
<Fill>
<CssParameter name="fill">#00FFFF</CssParameter>
</Fill>
</Mark>
<Opacity>
<ogc:Literal>1.0</ogc:Literal>
</Opacity>
<Size>
<ogc:Literal>7.5</ogc:Literal>
</Size>
<Rotation>
<ogc:Literal>5.5</ogc:Literal>
</Rotation>
</Graphic>
</PointSymbolizer>
</Rule>

...
...

<!--
*
*
* Category 2: module [2.0 - 3.9999]
*
*
-->
<Rule>
<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:And>
<ogc:PropertyIsBetween>
<ogc:PropertyName>module</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>2.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>3.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
<ogc:PropertyIsBetween>
<ogc:PropertyName>direction</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>0.0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>2.9999</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:And>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>arrow</WellKnownName>
<Fill>
<CssParameter name="fill">#17E8FF</CssParameter>
</Fill>
</Mark>
<Opacity>
<ogc:Literal>1.0</ogc:Literal>
</Opacity>
<Size>
<ogc:Literal>9.5</ogc:Literal>
</Size>
<Rotation>
<ogc:Literal>1.0</ogc:Literal>
</Rotation>
</Graphic>
</PointSymbolizer>
</Rule>

...
...

Hope can help.

Cheers,
               Alessio.

On 7/19/05, Alessio Fabiani <alessio.fabiani@anonymised.com> wrote:

Hi Bryce,
we had a similar problem here...At the end what we have done to render
wind arrows was:

1) Creating a Shapefile containing a set of points describing module
and rotation (computed by U and V components) for each arrow (with LAT
LON coordinates associated of course)

2) Building an SLD that drows an arrow with length and color
proportional to the module and the same rotation angle.

We built a software for automating the overall procedure.

The final SLD is quite big but the result is not bad.
Follows a little piece of the resulting SLD. as you can see the main
problem is that because it's not possible to use the shape property
values directly, we had to subdivide modules and directions into
categories. The software we made automatically writes the set of rules
for each direction every module category.
In the example below we have a rule each 2 direction degrees for each
module category.

I must be missing something here - why can't you use the magnitude and
rotation directly in a single rule.

e.g:

<FeatureTypeStyle>
        <FeatureTypeName>testPoint</FeatureTypeName>
        <rule>
            <PointSymbolizer>
                <graphic>
                    <size><PropertyName>size</PropertyName></size>
                    <rotation><PropertyName>rotation</PropertyName></rotation>
                    <mark>
                       
<wellknownname><PropertyName>name</PropertyName></wellknownname>
                        <Fill>
                            <!-- CssParameters allowed are fill (the
color) and fill-opacity -->
                            <CssParameter name="fill">#FF0000</CssParameter>
                            <CssParameter name="fill-opacity">0.5</CssParameter>
                        </Fill>
                    </mark>
                </graphic>
            </PointSymbolizer>
        </rule>
    </FeatureTypeStyle>

Ian
--

Ian Turton
http://www.geotools.org
http://www.ccg.leeds.ac.uk

I tried, but without success ... maybe I missed something.

On 7/19/05, Ian Turton <ijturton@anonymised.com> wrote:

On 7/19/05, Alessio Fabiani <alessio.fabiani@anonymised.com> wrote:
> Hi Bryce,
> we had a similar problem here...At the end what we have done to render
> wind arrows was:
>
> 1) Creating a Shapefile containing a set of points describing module
> and rotation (computed by U and V components) for each arrow (with LAT
> LON coordinates associated of course)
>
> 2) Building an SLD that drows an arrow with length and color
> proportional to the module and the same rotation angle.
>
> We built a software for automating the overall procedure.
>
> The final SLD is quite big but the result is not bad.
> Follows a little piece of the resulting SLD. as you can see the main
> problem is that because it's not possible to use the shape property
> values directly, we had to subdivide modules and directions into
> categories. The software we made automatically writes the set of rules
> for each direction every module category.
> In the example below we have a rule each 2 direction degrees for each
> module category.
>

I must be missing something here - why can't you use the magnitude and
rotation directly in a single rule.

e.g:

<FeatureTypeStyle>
       <FeatureTypeName>testPoint</FeatureTypeName>
       <rule>
           <PointSymbolizer>
               <graphic>
                   <size><PropertyName>size</PropertyName></size>
                   <rotation><PropertyName>rotation</PropertyName></rotation>
                   <mark>

<wellknownname><PropertyName>name</PropertyName></wellknownname>
                       <Fill>
                           <!-- CssParameters allowed are fill (the
color) and fill-opacity -->
                           <CssParameter name="fill">#FF0000</CssParameter>
                           <CssParameter name="fill-opacity">0.5</CssParameter>
                       </Fill>
                   </mark>
               </graphic>
           </PointSymbolizer>
       </rule>
   </FeatureTypeStyle>

Ian
--

Ian Turton
http://www.geotools.org
http://www.ccg.leeds.ac.uk