-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[E & A] Implement colormap configurability (#1117)
**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
- Loading branch information
Showing
24 changed files
with
786 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { atomWithUrlValueStability } from '$utils/params-location-atom/atom-with-url-value-stability'; | ||
|
||
const initialParams = new URLSearchParams(window.location.search); | ||
|
||
export const reverseAtom = atomWithUrlValueStability<boolean>({ | ||
initialValue: initialParams.get('reverse') === 'true', | ||
urlParam: 'reverse', | ||
hydrate: (value) => value === 'true', | ||
areEqual: (prev, next) => prev === next, | ||
dehydrate: (value) => (value ? 'true' : 'false') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.