Reading-eScience-Centre / edal-java

Environmental Data Abstraction Layer libraries
Other
39 stars 30 forks source link

We need legend labels with all the thresholds #107

Open David-Gil opened 6 years ago

David-Gil commented 6 years ago

We create weather probabilistic products with thresholds 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% and 100%.

I have created a custom style with the Categorize symbolizer (taken from your answer) that takes into account those thresholds in the map.

The problem comes with the generated legend labels: it doesn't show all the thresholds next to the correspondent color. Instead, it calculates a few values (low, medLow, medHigh and high) and only shows those.

Is there a way to show all the thresholds in the legend next to their color? We're used to matplotlib, with which it is fairly easy to do.

Thank you for your time.

guygriffiths commented 6 years ago

This shouldn't be too tricky to do, although I don't have a great deal of time to work on EDAL/ncWMS at the moment. What are you using which doesn't show the values? Godiva3, or a GetLegendGraphic call?

David-Gil commented 6 years ago

I use THREDDS.

guygriffiths commented 6 years ago

What client are you using - i.e. what is generating the legend? If you're not sure, can you attach a screenshot?

geojs commented 6 years ago

With a forked ncWMS 1.2, I did this kind of legend (wave height) with a GetLegendGraphic call: wms

David-Gil commented 6 years ago

I'm sorry I haven't answered until now. I have been very busy with other projects.

We get the legend with the GetLegendGraphic call. This is what I get now:

legend

@geojs has attained just what we need! The problem is that I don't know when it will be available for THREDDS (or if it will be available at all). Therefore we began making our own legends in SVG.

Anyway, I think it is a very desirable feature for future versions.

guygriffiths commented 6 years ago

@David-Gil - I've just implemented this is the develop branch. Any colour schemes which define specific points will now have them labelled in the image returned from GetLegendGraphic. This will make it into the next release.

geojs commented 6 years ago

@guygriffiths - thanks, I changed in /ncWMS2/WEB-INF/lib/ the edal-graphics-1.4.0.jar with edal-graphics-1.4.1-SNAPSHOT.jar from develop branch.

The result with an sld using ColorMap and Categorize: ?FORMAT=image%2Fpng&TRANSPARENT=TRUE&STYLE=hs&LAYERS=hs%2FHs&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic getlegendgraphic

Is it possible to have an option (in the sld) to have the same rectangle height for each threshold ?

The colorbar only legend has the same rectangle height for each threshold: ?FORMAT=image%2Fpng&SERVICE=WMS&PALETTE=hs_palette&VERSION=1.1.1&COLORBARONLY=true&REQUEST=GetLegendGraphic&NUMCOLORBANDS=31 colorbar

guygriffiths commented 6 years ago

I'll have a look into it when I have some time, but it's far from straightforward. The colorbar only legend is generating the colorbar from the palette name, which I think is only the same because you've designed your style hs from those colour values.

David-Gil commented 6 years ago

Thank you, @guygriffiths !!