Skip to main content
Question

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


Forum|alt.badge.img

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

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • March 11, 2019

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.

 


Forum|alt.badge.img
  • Author
  • March 11, 2019
takashi wrote:

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


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • March 11, 2019
takashi wrote:

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)


Forum|alt.badge.img
  • Author
  • March 14, 2019

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)


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • March 14, 2019
alex_chris wrote:

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.


johannafalk
Contributor
Forum|alt.badge.img+6
  • Contributor
  • August 27, 2020

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings