Question

Create a 3 band raster from elevation and external clr or txt color map file

  • 11 March 2019
  • 6 replies
  • 14 views

Badge

I have a workspace that has as outputs some 3d models and uploads them onto Cesium. The inputs are a single band raster with elevation as a value. I convert this raster in a TIN and using appearance setter I drape a texture on top of it.

Said texture is a 3 band (RGB) raster which is created from the elevation values, matched with a file that tells the ranges of height and the colours to apply. At the moment I generate this raster in GDAL using gdaldem color relief.

 

Does FME have a similar transformer or workflow?


6 replies

Userlevel 2
Badge +17

Hi @alex_chris, a possible approach is:

  1. Create an RGB24 color palette definition (text). See the help on the RasterPaletteExtractor to learn how to define a palette.
  2. Transform the source raster into a UInt8 single band raster, so that each cell value in the resulting raster is a palette key corresponding to a color for the elevation value.
  3. Merge the palette definition as a string attribute to the raster feature.
  4. Add the palette to the raster with the RasterPaletteAdder.

If you could share a source raster file and a color map text file (defining elevation range - R, G, B), I would try to create a workflow example.

 

Badge

Hi @alex_chris, a possible approach is:

  1. Create an RGB24 color palette definition (text). See the help on the RasterPaletteExtractor to learn how to define a palette.
  2. Transform the source raster into a UInt8 single band raster, so that each cell value in the resulting raster is a palette key corresponding to a color for the elevation value.
  3. Merge the palette definition as a string attribute to the raster feature.
  4. Add the palette to the raster with the RasterPaletteAdder.

If you could share a source raster file and a color map text file (defining elevation range - R, G, B), I would try to create a workflow example.

 

sure @takashi, here is a sample of the elevation raster (REAL32)GEOTIFF.tif

Here is the colormap I use to create the three band raster (externally) color_map.txt

 

And also the entire workbench (it does a lot of stuff but I disabled what is not needed)geotiff_to_FMEAR_2018.fmw

 

Thanks

Userlevel 2
Badge +17

Hi @alex_chris, a possible approach is:

  1. Create an RGB24 color palette definition (text). See the help on the RasterPaletteExtractor to learn how to define a palette.
  2. Transform the source raster into a UInt8 single band raster, so that each cell value in the resulting raster is a palette key corresponding to a color for the elevation value.
  3. Merge the palette definition as a string attribute to the raster feature.
  4. Add the palette to the raster with the RasterPaletteAdder.

If you could share a source raster file and a color map text file (defining elevation range - R, G, B), I would try to create a workflow example.

 

Hopefully this example might help you: create-and-add-palette-example.fmwt (FME 2018.1.1)

Badge

That's what I needed, thanks thanks and again thanks @takashi, I would have never figured out how to do it with FME. Just one more little thing...how could I tweak the raster cell size (or raster resolution) of the output in such workspace? (the output at the moment is a bit too crude)

Userlevel 2
Badge +17

That's what I needed, thanks thanks and again thanks @takashi, I would have never figured out how to do it with FME. Just one more little thing...how could I tweak the raster cell size (or raster resolution) of the output in such workspace? (the output at the moment is a bit too crude)

Have a look at the RasterResampler transformer.

Badge

Hello. Is there a chance to download the examples mentioned above? like: create-and-add-palette-example.fmwt

Since I have to deal with a similar problem, it would be very helpful!

Thanks

Reply