Customizing the Godiva2 web client interface

This page gives tips on how to customize the Godiva2 web client to your particular needs.

  1. Customizing the left-hand menu
    1. Displaying all datasets on the server in a list
    2. Displaying datasets organized into folders
    3. Organizing layers individually
    4. Displaying datasets from remote servers
    5. More advanced: use JSTL expression language for more control
  2. Adding new colour palettes
  3. Adding new background maps
  4. Creating a "branded" version of the Godiva2 website

Customizing the left-hand menu

By default, the left-hand menu of datasets is just a list of all the datasets on your server. It's possible generate your own menu structure if you wish, to organize datasets in a more logical fashion. (This is done on, for instance.) You do this by editing the Java Server Pages (JSPs) in the WEB-INF/jsp directory of your ncWMS installation.

The default menu is defaultMenu.jsp, but you can have many menus (for example, to customize the view for different projects). For example, you can create a menu called myprojectMenu.jsp. This would be loaded by adding ?menu=myproject to the URL of your Godiva2 page, e.g.

To make the job of creating menus easier, ncWMS provides a set of custom JSP tags:

menu:folderCreates an empty folder into which datasets and layers can be placed
menu:datasetCreates a folder with the title of a given dataset, populated with all the layers in that dataset
menu:layerCreates a link to a particular layer

The following are some recipes for creating certain types of custom menu. You can also look in the ncWMS codebase for example menus that have been created for specific projects (e.g. ecoopMenu.jsp is used for the ECOOP DQV site,

Displaying all datasets on the server in a list

(This is the default behaviour of defaultMenu.jsp)

<menu:folder label="${serverTitle}">
    <c:forEach items="${datasets}" var="dataset">
        <menu:dataset dataset="${dataset.value}"/>

Displaying datasets organized into folders

<menu:folder label="${serverTitle}">
    <menu:folder label="Ocean forecasts">
        <menu:dataset dataset="${datasets.MY_MODEL1}"/> <%-- MY_MODEL1 is the dataset id --%>
        <menu:dataset dataset="${datasets.MY_MODEL2}" label="A really good model"/> <%-- overrides the default dataset title --%> 
    <menu:folder label="Satellite observations">
        <menu:dataset dataset="${dataset.value}"/>

Organizing layers individually

You may wish to use this feature to make layers from different datasets appear together in the menu. This is useful if, for example, you store temperatures and velocities in separate datasets, but you want them to appear together. Note that the mechanism for this changed in version [788] on Subversion (1st July 2010):

Previous to version 788, including 1.0RC2

<menu:folder label="My wonderful server">
    <menu:folder label="A great model">
        <menu:layer dataset="${datasets.MERSEA_MED_T}" id="temperature" label="sea_water_potential_temperature"/>
        <menu:layer dataset="${datasets.MERSEA_MED_U}" id="u" label="eastward_sea_water_velocity"/>
        <menu:layer dataset="${datasets.MERSEA_MED_V}" id="v" label="northward_sea_water_velocity"/>

Version 788 and later

<menu:folder label="My wonderful server">
    <menu:folder label="A great model">
        <menu:layer dataset="${datasets.MERSEA_MED_T}" name="MERSEA_MED_T/temperature" label="sea_water_potential_temperature"/>
        <menu:layer dataset="${datasets.MERSEA_MED_U}" name="MERSEA_MED_U/u" label="eastward_sea_water_velocity"/>
        <menu:layer dataset="${datasets.MERSEA_MED_V}" name="MERSEA_MED_V/v" label="northward_sea_water_velocity"/>

Displaying datasets from remote servers

Note: this will only work if your server is running a recent Subversion checkout: 1.0RC1 does not support this. The remote servers do not need to be running such a recent version, but 1.0BETA is not supported.

You can configure your custom menu to display datasets from external ncWMS servers:

<menu:folder label="My wonderful server">
    <menu:folder label="A great model">
        <menu:remoteLayer server="" layerName="NCOF_IRISH/sst" label="sea_water_temperature"/>

More advanced: use JSTL expression language for more control

Thanks to Adam Lundrigan of Fisheries and Oceans Canada for this example. This displays all the datasets whose id begins with the string "MO_PSY3V2R2_" in the same folder (note the taglib import to use the fn: functions):

    <%@ taglib prefix="fn" uri="" %>
    <menu:folder label="Bunch of datasets">
        <c:forEach items="${datasets}" var="dataset">
            <c:if test="${fn:startsWith(dataset.key, 'MO_PSY3V2R2_')}">
                <menu:dataset dataset="${dataset.value}" />

More information on JSTL expression language can be found on the web.

Adding new colour palettes

Colour palettes are stored in the WEB-INF/conf/palettes directory of the ncWMS installation on your server. The format of each palette file is a simple list of RGB colours; see trunk/web/WEB-INF/conf/palettes for some examples. Each RGB colour can either be specified as a triple of integers (in the range 0 to 255) or floating-point numbers (in the range 0.0 to 1.0). Each file has a .pal extension.

You can add your own colour palette by creating your own .pal file in this directory with your list of RGB colours. ncWMS automatically performs interpolation between these colours to produce palettes with different numbers of unique colours, depending on the client's NUMCOLORBANDS request. For example, a simple red-white-blue palette file has the form:

# Lines starting with the hash sign are comments
255 0 0
255 255 255
0 0 255

or, equivalently:

1.0 0.0 0.0
1.0 1.0 1.0
0.0 0.0 1.0

Your palette file should show up automatically in the Godiva2 client (you may need to reboot your server).

Adding new background maps

Creating a "branded" version of the Godiva2 website