Search code examples
openlayers

COG tiff interpolated colors and null value


I have built this sample output https://codesandbox.io/s/cog-no-data-interpolate-hhytfw?file=/main.js

I have a COG tiff with no data values, and I have applied it setting nodata: NaN.

Then I have applied a color map, but when I applied it, the no data pixels become colored.

How to apply this kind of palette and manage properly the no data pixels?

Thank you


Solution

  • Specifying a nodata value adds an extra band to the output which can be used as alpha in the style, or when as in you case there is also an interpolation it might be easier to test for it being 0:

    https://codesandbox.io/s/cog-no-data-interpolate-forked-xu6zjg