Skip to content

Add custom GDAL color table support for COG layers via TiTiler#1017

Open
jdrodjpl wants to merge 5 commits into
developmentfrom
cog-gdal-colortable-clean
Open

Add custom GDAL color table support for COG layers via TiTiler#1017
jdrodjpl wants to merge 5 commits into
developmentfrom
cog-gdal-colortable-clean

Conversation

@jdrodjpl

Copy link
Copy Markdown
Contributor

Adds a cogColormapJson layer config field ("Custom Color Table (GDAL)", in its own section of the COG tab) that is passed through to TiTiler's colormap query parameter. Accepts either a discrete value-to-RGBA map (e.g. {"1":[10,40,85,255]}) or a list of [[min,max],RGBA] intervals, letting classified rasters (land cover, sea-ice type, etc.) be colored by raw pixel value.

Behavior:

  • The color table supersedes the named Colormap (colormap_name), and the Colormap dropdown disables itself with an explanatory tooltip when both a color table and the COG transform are set (via a new generic disableWhen hook in the configure app's Maker)
  • rescale is suppressed when a color table is set: TiTiler applies rescale before the colormap lookup, which would remap raw values away from the table's keys
  • A discrete legend (one labeled color chip per class or interval, suffixed with cogUnits) is generated automatically through the LegendTool/populateCogScale path, with or without the COG transform enabled; fully transparent entries (e.g. nodata) are skipped
  • The layer settings panel renders the color table as a swatch strip in place of the named-colormap preview image

@jdrodjpl
jdrodjpl requested a review from tariqksoliman July 15, 2026 19:14
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

✅ Version Already Updated

This PR includes a manual version update to 5.2.22-20260721

No automatic version bump needed.

Comment thread plugins/core/tools/Layers/LayersTool.js
Comment thread plugins/core/tools/Layers/LayersTool.js
@tariqksoliman tariqksoliman added the enhancement For making an existing feature better label Jul 20, 2026
Adds a cogColormapJson layer config field ("Custom Color Table (GDAL)",
in its own section of the COG tab) that is passed through to TiTiler's
`colormap` query parameter. Accepts either a discrete value-to-RGBA map
(e.g. {"1":[10,40,85,255]}) or a list of [[min,max],RGBA] intervals,
letting classified rasters (land cover, sea-ice type, etc.) be colored
by raw pixel value.

Behavior:
- The color table supersedes the named Colormap (colormap_name), and
  the Colormap dropdown disables itself with an explanatory tooltip
  when both a color table and the COG transform are set (via a new
  generic `disableWhen` hook in the configure app's Maker)
- rescale is suppressed when a color table is set: TiTiler applies
  rescale before the colormap lookup, which would remap raw values
  away from the table's keys
- A discrete legend (one labeled color chip per class or interval,
  suffixed with cogUnits) is generated automatically through the
  LegendTool/populateCogScale path, with or without the COG transform
  enabled; fully transparent entries (e.g. nodata) are skipped
- The layer settings panel renders the color table as a swatch strip
  in place of the named-colormap preview image
@jdrodjpl
jdrodjpl force-pushed the cog-gdal-colortable-clean branch from 5562c92 to 28b869b Compare July 21, 2026 18:43
@jdrodjpl
jdrodjpl force-pushed the cog-gdal-colortable-clean branch from fe275c3 to 234db9f Compare July 21, 2026 18:48

@tariqksoliman tariqksoliman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Feel free to merge.

@tariqksoliman

Copy link
Copy Markdown
Member

Oh, one thing I forgot: If possible can you add a layer to the Reference-Mission blueprint showing off this feature,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement For making an existing feature better

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants