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

[E & A] Implement colormap configurability #994

Closed
4 tasks
aboydnw opened this issue Jun 7, 2024 · 6 comments
Closed
4 tasks

[E & A] Implement colormap configurability #994

aboydnw opened this issue Jun 7, 2024 · 6 comments
Assignees

Comments

@aboydnw
Copy link
Contributor

aboydnw commented Jun 7, 2024

Context

An implementation ticket for the design ticket here: #929

Acceptance Criteria

  • Users are able to change the color map to one of the options we provide them
  • Color map defaults are able to be defined by data providers and identified in the app, even after changing
  • Users can edit the rescale values to change the visualization of the data
  • Use new titiler API, backend titiler update: feat: titiler-pgstac v1 upgrade veda-backend#398
@aboydnw
Copy link
Contributor Author

aboydnw commented Jun 10, 2024

Once we close this, we can close a related GHG ticket: https://github.com/US-GHG-Center/feature-requests/issues/3

@faustoperez
Copy link

faustoperez commented Aug 16, 2024

Hey @dzole0311 👋

Based on the team conversations we had this week I updated the designs of the Colormap options selector:

  • Changed the icon to one from the Collecticons library
  • Added a Reset button. The Reset button should be enabled once the user has changed an option.
  • Make the toggle switch in the OFF position a lighter blue or even gray, at the moment there is not a lot of difference between ON and OFF apart from the position 👍

Link to Figma 👉 https://www.figma.com/design/9INQauBWhiRxvOWDGhRrxO/US-GHG-Center?node-id=1781-3165&t=8tmNwMDSmSA7hY3c-1

Desktop Flow

@dzole0311
Copy link
Collaborator

Thanks @faustoperez - should be easy to add the 'Reset' option.

I couldn't find the icon in the USWDS icon list. Is it coming from there? If not, could we switch to one from the USWDS collection?

@faustoperez
Copy link

faustoperez commented Aug 16, 2024

I couldn't find the icon in the USWDS icon list. Is it coming from there? If not, could we switch to one from the USWDS collection?

I didn't find any suitable icon on the USWDS list, that's why I proposed one from Collecticons. If this is a concern, let's skip the icon for now 🙂

@j08lue
Copy link
Contributor

j08lue commented Aug 22, 2024

@faustoperez - when reading the legend, I am unable to see at a glance, what the units are. They are only part of the list of properties under the dataset title. Would you consider to somehow associate them more closely with the legend?

Sorry this comment is coming so late...

@faustoperez
Copy link

That's a good call Jonas, I did play with the position of the units on this card design. In the previous design sometimes the legend was truncated depending on the actual length of the colormap values.

I wanted to leave space on the colormap legend in case we had long numbers, or divergent scales with a zero in the center.

We could revise these decisions in a future iteration.

dzole0311 added a commit that referenced this issue Aug 28, 2024
**Related Ticket:** #994 

### Description of Changes
I made the colormap default to be returned along with other settings
values - I think this saves some redundancies of retrieving the value of
colormap, and fits well with the existing pattern.
I eliminated reconciling functions from data-util (and used the function
from data-util-no-faux-module) so there is no confusion about which
function is being called.
dzole0311 added a commit that referenced this issue Aug 29, 2024
**Related Ticket:** #994

### Description of Changes

Implements the color map configuration of E&A layers.

Changes:

- Adds curated list of supported color maps taken from the back-end,
split into diverging and sequential groups
- Supports other valid color map names from the list of color maps:
https://openveda.cloud/api/raster/colorMaps
- Adds support for reversing the colors
- Adds reset all button which currently only resets the "Reverse"
option, but will also apply to the "Rescale" functionality which is to
be added next
- Added a loading skeleton to the colormap in the timeline sidebar when
a layer is added. This prevents a visual flash because it might take a
second to fetch the color map from the back-end (cc @faustoperez )

The precedence of the color maps are as follows:

1. Start with what is configured in the sourceParams of the dataset
2. If it's not defined, check for the dashboard render configuration
coming from STAC endpoint
3. If still undefined, check for asset-specific renders using the
sourceParams' assets. This is a special edge case for some datasets that
have multiple assets (multiple assets under one collection item)
4. If all else fails, default to `viridis`

Please let me know your thoughts on that or if you spot something
strange

### Notes & Questions About Changes

- I additionally pushed a shell script that I used to build the
`colorMaps.ts` file, I hope that's okay. It fetches all the `rgba`
values for each supported colorMap from titiler. We could extend it and
integrate it within our Github workflow in the future, so that the
colors are fetched on each new release (although it's unlikely they will
change that often)
 
### Validation / Testing

- Verify that the color map list is correctly split into diverging and
sequential groups
- Check that reversing the color map works as expected and toggles
correctly
- Test the "Reset All" button to ensure that it resets the "Reverse"
option and works as intended
- Check that the precedence of the color maps is followed in the correct
order:

1. Start with sourceParams of the dataset
2. Fallback to dashboard render configuration from the STAC endpoint
3. If undefined, check for asset-specific renders using sourceParams'
assets
4. Finally, default to `viridis` if all else fails

- Verify that the changes do not break any existing functionality
related to rendering of the tiles on the map (selected color map must
match the tile colors)
- Test across different datasets with both single and multiple assets to
confirm edge cases are handled as described
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

4 participants