Solved

Raster with 1 channel and 3 values as palettes - strange!

  • 21 November 2022
  • 3 replies
  • 3 views

Badge +21

I`m trying to make a strange raster, due to a specific software demanding exactly that format.

 

It seems to be a GeoTIFF with 1 rasterband (UINT8) that has palettes with 3 values (RGB). See below for more information. I have managed to create the 1 channel TIF with the correct value, however I struggle to add the palette, and add the correct value for each palette to each pixel.

 

Since FME can read the file correctly, I assume it can also create such a file, however I am stuck after examining all the RasterPalette* Transformers.

 

Any raster-wizards out there?

 

imageimageimageimage

icon

Best answer by daveatsafe 21 November 2022, 23:15

View original

3 replies

Userlevel 2
Badge +17

Hi @Sigbjørn Herstad​,

If you have a standard three band RGB image, the RasterPaletteGenerator will convert it into a 1 band image with an optimized RGB palette. This is normally the easiest method to use. If you just have the one band index raster, you can convert this to a palette using the RasterPaletteAdder. You will need to create an attribute containing the text of the palette definition first. For more information, please see the documentation for the RasterPaletteAdder.

Badge +21

Hi @Sigbjørn Herstad​,

If you have a standard three band RGB image, the RasterPaletteGenerator will convert it into a 1 band image with an optimized RGB palette. This is normally the easiest method to use. If you just have the one band index raster, you can convert this to a palette using the RasterPaletteAdder. You will need to create an attribute containing the text of the palette definition first. For more information, please see the documentation for the RasterPaletteAdder.

Works like a charm. I ended up using the RasterPaletteExtractor on the sample file I had, to see the structure of the _palette property. And then I hand-write this and attached to my own data. Great! Thanks! Thought I knew everything about rasters, but this was a new one after 10 years!

Badge +21

I also see you can add multiple palettes. This is nice if you want multiple fields, for instance color and value and text and height etc. However when I try to write this to TIF I just get the error:

"GEOTIFF writer: Unsupported palette value interpretation 'STRING'. Please convert the interpretation to one of the following valid types: RGB24. This can be done with the RasterPaletteInterpretationCoercer transformer".

 

Are there any formats that do support multiple Palettes on single bands?

 

image

Reply