Repository navigation
Conversation
slesaad
force-pushed
the
feature/654-vector-colormap-simple
branch
from
November 20, 2026 22:04
18c1157 to
7a73d3e
Compare
A colorBy colormap can name a ramp only the layer's TiTiler defines; it is looked up once, and the layer paints its fixed colour until it arrives. Core answers three bus calls for raster and vector layers alike: layers:getColormaps lists the ramps a layer can offer, layers:getColormapColors returns one ramp's colours, and layers:setColormap applies a ramp or range change. A colorBy layer is restyled in place without refetching its data, on deck.gl and Leaflet GeoJSON. The Layer Manager's ramp picker and handlers only ask core, so its own TiTiler fetches, cache and config writes are gone.
slesaad
force-pushed
the
feature/654-vector-colormap-simple
branch
from
November 23, 2026 16:50
b55efa6 to
d79ed3e
Compare
A colorBy colormap whose ramp is neither bundled nor supplied by the layer's tiling service paints no feature, but its legend fell back to a viridis gradient. The ramp loader now answers null for such a ramp, and the legend draws no gradient while still naming the ramp and its range, so the ramp picker can change it.
layers:setColormap accepts only a name from the layer's layers:getColormaps list, in any casing, so neither a typo nor an unlisted reversed form can leave a layer painting nothing. The whole change is refused, range included.
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #654
Size
236 of the removed code lines are the Layer Manager's own colormap fetching and caching, now done by core.
Stacked on #658, which draws
style.colorByfrom config. This PR adds custom ramps and runtime changes. Review #658 first; this diff is against its branch.What
colorBycan name a ramp that only the layer's TiTiler defines, such asnaqfc_pm25. The ramp is looked up once and shared by every layer that names it. Until it arrives, the layer paints its fixed colour, then it is restyled. A failed lookup is retried after the service's failure window.layers:getColormaps: the ramp names a layer can be offered. This is its TiTiler's list, or the bundled ramps (forward and_r) when it has no TiTiler or the list can't be read.layers:getColormapColors: one ramp's colours, from the same lookup the map paints with.layers:setColormap: applies a ramp and/or range change. A raster takes it into its runtime colormap fields. A colorBy layer takes it into its setting and is restyled in place, without refetching data, on deck.gl and Leaflet GeoJSON. A layer that can't take the change is refused.<name>_r.titilerUrlon each one.Reading order
src/essence/Basics/Colormaps/:titilerColormaps.tsadds the cached ramp-list fetch.resolveColormapColors.tsaddslistColormaps, pluslookupColormapColors, which answers null for an unknown ramp instead of the fallback.src/essence/Basics/Layers_/ColorBy.ts:loadColormapRampand the cache of service-defined ramps.src/essence/Basics/Layers_/Layers_.js:restyleColorByLayerandensureColorByRamphandle late ramps.setLayerColormapand the three providers.cogCapabilitiesFornow answers for colorBy layers.src/essence/Basics/Map_/Map_.js:restyleLayer.DeckGLHelpers.ts:restyleDeckLayer, used byDeckGLAdapter.updateLayer.adapters/handlers.tssendslayers:setColormap.lib/utils/colormapSource.tsis what the picker's hooks read;MMGISLayerManagerAdapter.tsxinstalls it from the bus calls.colormapCache.tsare removed.Notes
Testing
npx vitest runpasses: 225 files and 3854 tests.npx tsc --noEmit -p .is clean.naqfc_pm25loads it from the service and repaints the points: value 1 goes from jet navy torgba(175,254,176), matching the service's table.viridis_rwith 3–5 repaints the points and updates the legend.layers:setColormapwithmagma_rand 1–9 updates its runtime colormap fields and its legend.