pacificclimate / climate-explorer-frontend

6 stars 1 forks source link

Allow users to change opacity on climate layers #106

Closed corviday closed 5 years ago

corviday commented 6 years ago

Francis Zwiers reports that it is difficult to make out terrain underlying raster layers from still image screenshots taken for a presentation, and suggests adding a way to allow users to change the opacity of the map overlay layers.

rod-glover commented 6 years ago

This issue has also been raised by MoTI. Therefore increasing urgency on it.

Jim Barnes (MoTI) suggested a show/hide (as opposed to opacity) control, which may be simpler to implement given the complexities of ncWMS layers. @corviday can you comment on layer opacity?

corviday commented 6 years ago

ncWMS accepts an opacity parameter from 0 to 100, with 100 being opaque and 0 being invisible.

We have historically had maddening difficulty dynamically setting the ncWMS opacity parameter, because the leaflet layer representing the ncWMS imagemap had its own opacity parameter, which ranged from 0 to 1, and some leaflet functions that received an opacity paramter would pass it to ncWMS via query while some would apply it to the leaflet layer instead (and throw an error because the value was greater than 1).

I would expect that upgrading to the modern version of leaflet has fixed this issue, or at least produced documentation about which functions do what - I'm sure we weren't the only ones who ran into it! - but I haven't worked on this issue at all since you did the big leaflet upgrade, so I don't know for sure.

Our current setup uses only the leaflet layer opacities, and they're set at layer initialization - .75 for raster layers and 1 for coloured isoline and labeled isoline layers. All ncWMS queries are run without an opacity parameter, which defaults to 100% opacity.