Solved

How To Transform DEM/DTM Gray8 TIF To RGB32 TIF With Color Based On Gray8 Value (elevation)

  • 27 June 2018
  • 6 replies
  • 17 views

Badge

Hi everyone,

Does anyone know how to convert DEM/DTM gray8 tif to rgb32 tif with the desired elevation color scheme by using FME Desktop?

Gray8

RGB32

I know a lot of online GIS software may do it on the fly...but I am using MapGuide which seems allowing me to change the color scheme of my gray8 dem tif.

Thanks a lot,

Reno

icon

Best answer by takashi 28 June 2018, 00:15

View original

6 replies

Userlevel 2
Badge +17

Hi @renosungis, a possible way is: change the Gray8 1 band raster to Uint8 1 band raster (RasterBandInterpretationCoercer), add a new attribute storing an RGBA32 color palette definition which you want to map each cell value (0-255) to a color value, and add the palette to the raster (RasterPaletteAdder). Optionally you can then apply the RasterPaletteResolver to change the Uint8 1 band (with a palette) raster to RGBA32 4 band raster.

See the help on the RasterPaletteExtractor to learn about the format of palette definition.

However, I think it would be very tedious to define a palette with 256 entries (0-255) manually. Hopefully the RGBGradationCalculator from FME Hub might help you to generate a palette definition for a color ramp based on some seed colors. See the help on the custom transformer to learn more.

Example: This image raster was created from a Uint8 1 band raster and a palette attribute which was generated by the RGBGradationCalculator with the following parameters setting.

Badge

Thank you so much @takashi !

It works nicely!

Badge

Hi @renosungis, a possible way is: change the Gray8 1 band raster to Uint8 1 band raster (RasterBandInterpretationCoercer), add a new attribute storing an RGBA32 color palette definition which you want to map each cell value (0-255) to a color value, and add the palette to the raster (RasterPaletteAdder). Optionally you can then apply the RasterPaletteResolver to change the Uint8 1 band (with a palette) raster to RGBA32 4 band raster.

See the help on the RasterPaletteExtractor to learn about the format of palette definition.

However, I think it would be very tedious to define a palette with 256 entries (0-255) manually. Hopefully the RGBGradationCalculator from FME Hub might help you to generate a palette definition for a color ramp based on some seed colors. See the help on the custom transformer to learn more.

Example: This image raster was created from a Uint8 1 band raster and a palette attribute which was generated by the RGBGradationCalculator with the following parameters setting.

Hi @takashi,

 

 

Are there any ways to display more details like the second map of my question?

 

 

I tried to change the RGBGradationCalculator - Seed Colors, but have no luck in generating the image averagely using all colors.

 

 

Seed Colors: 255,0,0;255,255,0;0,255,0;0,0,255;255,0,255

 

 

 

Really appreciate!

 

Reno
Userlevel 2
Badge +17

Hi @renosungis, a possible way is: change the Gray8 1 band raster to Uint8 1 band raster (RasterBandInterpretationCoercer), add a new attribute storing an RGBA32 color palette definition which you want to map each cell value (0-255) to a color value, and add the palette to the raster (RasterPaletteAdder). Optionally you can then apply the RasterPaletteResolver to change the Uint8 1 band (with a palette) raster to RGBA32 4 band raster.

See the help on the RasterPaletteExtractor to learn about the format of palette definition.

However, I think it would be very tedious to define a palette with 256 entries (0-255) manually. Hopefully the RGBGradationCalculator from FME Hub might help you to generate a palette definition for a color ramp based on some seed colors. See the help on the custom transformer to learn more.

Example: This image raster was created from a Uint8 1 band raster and a palette attribute which was generated by the RGBGradationCalculator with the following parameters setting.

0684Q00000ArLYwQAN.png

0684Q00000ArLRFQA3.png

Try other seed colors settings. e.g.

 

255,0,0; 255,255,0; 0,255,0; 0,255,255; 0,0,255

 

Badge
Try other seed colors settings. e.g.

 

255,0,0; 255,255,0; 0,255,0; 0,255,255; 0,0,255

 

Hi @takashi,

 

 

It still won't use all the colors from the seed color. No matter I am using FME color or RGB24. 

 

 

I think the area is not big enough to utilize all the seed color since the largest REAL64 cell value was about 100, and lowest value was about 0. The REAL64 cell was using decimal values. However, the RasterBandInterpretationCoercer turned each cell value into a round integer value (Uint8).

 

 

My DEM was grey8, but I generated a new dem using FME instead of using ArcGIS Pro. Therefore, my DEM raster is in REAL64 now.

 

 

Please helps. I was trying change the destination interpretation type of the RasterBandInterpretationCoercer to Real32, since I am hoping to keep the REAL64 decimal value.

 

 

Thanks,

 

Reno
Badge
Try other seed colors settings. e.g.

 

255,0,0; 255,255,0; 0,255,0; 0,255,255; 0,0,255

 

Hi @takashi,

 

 

Problem solved! I just need to change the parameters of the RasterInterpretationCoercer.

 

  1. Convert Color to Numeric: Scale by data values
  2. Convert from Numeric to Numeric:Scale by data values
Cheers,

 

Reno

Reply