Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style with scalar and vector field #120

Open
marceloandrioni opened this issue Aug 28, 2019 · 2 comments
Open

Style with scalar and vector field #120

marceloandrioni opened this issue Aug 28, 2019 · 2 comments

Comments

@marceloandrioni
Copy link

marceloandrioni commented Aug 28, 2019

Hello, I am trying to create a new style based on this example from the EDAL User Guide. Basically a scalar field (ssh) with a vector field (current direction) over.

To test the setup first I created one style for the ssh (style_ssh.xml) and one style for the current (style_uv.xml). Restarted Tomcat and the new styles were correctly recognized as shown in the images below.
style_ssh
style_uv

I then joined the styles in a single file (style_sshuv.xml) and tested on the SLD Parser Test Tool. The Parser Test showed exactly the image I expected:
style_sshuv

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.1.0" xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:se="http://www.opengis.net/se" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:resc="http://www.resc.reading.ac.uk">
  <NamedLayer>
    <se:Name>remo_hycom124_2d/ssh</se:Name>
    <UserStyle>
      <se:Name>Red-blue palette showing SSH</se:Name>
      <se:CoverageStyle>
        <se:Rule>
          <se:RasterSymbolizer>
            <se:Opacity>1.0</se:Opacity>
            <se:ColorMap>
              <resc:Segment>
                <se:LookupValue>Rasterdata</se:LookupValue>
                <resc:BelowMinValue>extend</resc:BelowMinValue>
                <resc:ValueList>
                  <se:Name>div-BuRd2</se:Name>
                </resc:ValueList>
                <resc:AboveMaxValue>extend</resc:AboveMaxValue>
                <resc:Range>
                  <resc:Minimum>-1.0</resc:Minimum>
                  <resc:Maximum>1.0</resc:Maximum>
                  <resc:Spacing>linear</resc:Spacing>
                </resc:Range>
                <resc:NumberOfSegments>250</resc:NumberOfSegments>
              </resc:Segment>
            </se:ColorMap>
          </se:RasterSymbolizer>
        </se:Rule>
      </se:CoverageStyle>
    </UserStyle>
  </NamedLayer>
  <NamedLayer>
    <se:Name>remo_hycom124_2d/u:v-dir</se:Name>
    <UserStyle>
      <se:Name>Arrows showing current direction</se:Name>
      <se:CoverageStyle>
        <se:Rule>
          <resc:ArrowSymbolizer>
            <se:Opacity>1.0</se:Opacity>
            <resc:ArrowSize>8</resc:ArrowSize>
            <resc:ArrowColour>#FF000000</resc:ArrowColour>
            <resc:ArrowBackground>transparent</resc:ArrowBackground>
            <resc:ArrowStyle>FAT_ARROW</resc:ArrowStyle>
          </resc:ArrowSymbolizer>
        </se:Rule>
      </se:CoverageStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I restarted Tomcat again but the new style doesn't appear in the drop-down list in the ssh or u:v-dir variables. Do someone has faced a similar problem and was able to solve it?

An example of the kind of file I am trying to visualize can be found here.

On a side note, assuming I manage to see the new style, I was also wondering if ncWMS/edal XML specification has a variable to represent just the name of the dataset and not the full name of the variable ($layerName is equal to dataset_name/variable_name). I am asking this because I have several datasets (multiple hydrodynamic models output) that share the same structure, that is, all have variables named ssh, u and v. With a variable representing just the name of the dataset I could write a single style that would work for all these datasets, e.g.:

...
  <NamedLayer>
    <se:Name>$datasetName/ssh</se:Name>
    <UserStyle>
   ...
    </UserStyle>
  </NamedLayer>
  <NamedLayer>
    <se:Name>$datasetName/u:v-dir</se:Name>
    <UserStyle>
   ...
    </UserStyle>
  </NamedLayer>

System:
ncWMS v2.4.1
Apache Tomcat/8.5.45
Linux x86_64 Kernel 4.15.0-58-generic

@guygriffiths
Copy link
Contributor

The reason the style is not appearing in the dropdown for either the ssh or the u:v-dir variables is because neither of those variables is sufficient for your style, it has to be the combination of the two. There is a feature in the latest snapshot version of ncWMS which allows variables to be logically grouped, so that they have a parent variable which would support this style. However, I think that this will cause issues with the fact that u:v-dir is already a "virtual" variable, and not something in the data. For now I think you will need to just specify the style manually in the GetMap URL, or use a third-party WMS viewer.

There is currently no way of referencing a general dataset in a style template.

I am not currently in a position to work on ncWMS, but I will leave this issue open, so that if I get some time I can have a look into it.

@marceloandrioni
Copy link
Author

Ok, too bad is not currently possible to do that in Godiva3. I think that despite all the support to use the ncWMS in other GIS applications most people still use Godiva3 for the easily available options of selecting time and height/depth dimensions, auto-color limits, etc, considering these extra WMS features are not implemented in ArcView or QGIS (or any plugin that I know of).

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants