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

Allow users to select color palette on ncWMS2 endpoints #2200

Open
rsignell-usgs opened this issue Nov 4, 2016 · 3 comments
Open

Allow users to select color palette on ncWMS2 endpoints #2200

rsignell-usgs opened this issue Nov 4, 2016 · 3 comments

Comments

@rsignell-usgs
Copy link
Contributor

It would be useful to allow users to select the color palette on ncWMS2 endpoints, as shown here on the Godiva3 ncWMS2 client:
2016-11-04_7-21-09

On ncWMS2 endpoints, the palettes are not included as styles, but are contained in the GetCapabilities abstract. This would be nasty to parse, but ncWMS2 already supplies an easy way to retrieve this information, via a GetMetadata&item=layerDetails` extension. For example, this request:
http://geoport.whoi.edu/ncWMS2/wms?request=GetMetadata&item=layerDetails&layerName=FVCOM-NECOFS-GOM3/temp
returns this simple JSON structure with the palette info:

{
    "units": "degrees_C",
    "bbox":     [
        -75.68433380126953,
        35.27653121948242,
        -56.850791931152344,
        46.14595031738281
    ],
    "scaleRange":     [
        -1.931,
        21.93
    ],
    "numColorBands": 250,
    "supportedStyles":     [
        "default-scalar",
        "colored_contours",
        "contours",
        "raster"
    ],
    "noPaletteStyles": ["contours"],
    "categorical": false,
    "queryable": true,
    "downloadable": true,
    "continuousZ": false,
    "zaxis":     {
        "units": "level",
        "positive": true,
        "values":         [
            0,
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26,
            27,
            28,
            29,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39
        ]
    },
    "continuousT": false,
    "datesWithData": {"2016": {"10":     [
        1,
        2,
        3,
        4,
        5,
        6,
        7
    ]}},
    "timeAxisUnits": "ISO8601",
    "supportsTimeseries": true,
    "supportsProfiles": true,
    "supportsTransects": true,
    "nearestTimeIso": "2016-11-04T10:58:07.500Z",
    "moreInfo": "",
    "copyright": "",
    "palettes":     [
        "default",
        "default-inv",
        "div-BrBG",
        "div-BrBG-inv",
        "div-BuRd",
        "div-BuRd-inv",
        "div-BuRd2",
        "div-BuRd2-inv",
        "div-PRGn",
        "div-PRGn-inv",
        "div-PiYG",
        "div-PiYG-inv",
        "div-PuOr",
        "div-PuOr-inv",
        "div-RdBu",
        "div-RdBu-inv",
        "div-RdGy",
        "div-RdGy-inv",
        "div-RdYlBu",
        "div-RdYlBu-inv",
        "div-RdYlGn",
        "div-RdYlGn-inv",
        "div-Spectral",
        "div-Spectral-inv",
        "psu-inferno",
        "psu-inferno-inv",
        "psu-magma",
        "psu-magma-inv",
        "psu-plasma",
        "psu-plasma-inv",
        "psu-viridis",
        "psu-viridis-inv",
        "seq-BkBu",
        "seq-BkBu-inv",
        "seq-BkGn",
        "seq-BkGn-inv",
        "seq-BkRd",
        "seq-BkRd-inv",
        "seq-BkYl",
        "seq-BkYl-inv",
        "seq-BlueHeat",
        "seq-BlueHeat-inv",
        "seq-Blues",
        "seq-Blues-inv",
        "seq-BuGn",
        "seq-BuGn-inv",
        "seq-BuPu",
        "seq-BuPu-inv",
        "seq-BuYl",
        "seq-BuYl-inv",
        "seq-GnBu",
        "seq-GnBu-inv",
        "seq-Greens",
        "seq-Greens-inv",
        "seq-Greys",
        "seq-Greys-inv",
        "seq-GreysRev",
        "seq-GreysRev-inv",
        "seq-Heat",
        "seq-Heat-inv",
        "seq-OrRd",
        "seq-OrRd-inv",
        "seq-Oranges",
        "seq-Oranges-inv",
        "seq-PuBu",
        "seq-PuBu-inv",
        "seq-PuBuGn",
        "seq-PuBuGn-inv",
        "seq-PuRd",
        "seq-PuRd-inv",
        "seq-Purples",
        "seq-Purples-inv",
        "seq-RdPu",
        "seq-RdPu-inv",
        "seq-Reds",
        "seq-Reds-inv",
        "seq-YlGn",
        "seq-YlGn-inv",
        "seq-YlGnBu",
        "seq-YlGnBu-inv",
        "seq-YlOrBr",
        "seq-YlOrBr-inv",
        "seq-YlOrRd",
        "seq-YlOrRd-inv",
        "seq-cubeYF",
        "seq-cubeYF-inv",
        "x-Ncview",
        "x-Ncview-inv",
        "x-Occam",
        "x-Occam-inv",
        "x-Rainbow",
        "x-Rainbow-inv",
        "x-Sst",
        "x-Sst-inv"
    ],
    "defaultPalette": "default",
    "aboveMaxColor": "#FF000000",
    "belowMinColor": "#FF000000",
    "noDataColor": "transparent",
    "logScaling": false
}

The palette selected, for example x-Sst is then used in subsequent requests, like:
http://geoport.whoi.edu/ncWMS2/wms?FORMAT=image%2Fpng&TRANSPARENT=TRUE&STYLES=default-scalar%2Fx-Sst&LAYERS=FVCOM-NECOFS-GOM3%2Ftemp&TIME=2016-11-04T10%3A58%3A07.500Z&ELEVATION=0&COLORSCALERANGE=10.73%2C17.1&NUMCOLORBANDS=250&ABOVEMAXCOLOR=0x000000&BELOWMINCOLOR=0x000000&BGCOLOR=transparent&LOGSCALE=false&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG%3A4326&BBOX=-72.420933854153,39.933157812517,-71.023803124986,41.330288541684&WIDTH=256&HEIGHT=256

@kring
Copy link
Member

kring commented Feb 9, 2018

If ncWMS2 reported palettes as a dimension, this would work automatically. But with the current setup, it will need to be a ncWMS2-specific feature.

@rsignell-usgs
Copy link
Contributor Author

@guygriffiths, any chance of getting this working?
I guess responding on Reading-eScience-Centre/edal-java#86 would be better?

@guygriffiths
Copy link

@rsignell-usgs - The palettes are advertised as styles, it's just that only a subset of them are listed. Implemented palettes as another dimension could be done, but it's not a trivial task.

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

No branches or pull requests

3 participants