FME Transformers: 2024.1

Categories
Rasters
Related Transformers
AttributeFileReader
RasterBandInterpretationCoercer
RasterPaletteExtractor
RasterPaletteGenerator
RasterPaletteRemover
RasterPaletteResolver

RasterPaletteAdder

Creates a palette from an attribute, and adds this palette to all selected bands on a raster.

Jump to Configuration

Typical Uses

  • Adding palettes to rasters to meet format or processing requirements.

How does it work?

The RasterPaletteAdder receives raster features, and adds a palette to all selected bands.

The palette must be provided as an attribute, and the band(s) must have an interpretation type of UINT8, UINT16, or UINT32.

Palette keys will be discarded if they do not fit within the interpretation of a selected band. For example, when adding a palette to a UINT8 band, all keys greater than 255 will be dropped.

This transformer supports raster band selection. The RasterSelector can be used to modify selection.

Palettes

Palettes can be acquired and assigned to an attribute in a number of ways, including:

Format of Palette Attributes

The general format of a palette attribute is as follows:

Format

RGB Example

String Example

<value interpretation> [<string length>]
<key 0> <value 0>
<key 1> <value 1>
...
<key n> <value n>

RGB24
0 0,49,190
1 50,255,50
2 172,0,255
3 255,0,0

STRING 10
0 Water
1 Forest
2 Commercial
3 Urban

The first line of the palette must contain the value interpretation. Valid values for the value interpretation are:

  • RGB24
  • RGBA32
  • RGB48
  • RGBA64
  • GRAY8
  • GRAY16
  • STRING

RGBA and RGB palette values consist of comma-delimited strings of integers between 0 and the maximum value of the data type. For example, a valid RGBA32 value would be 64,128,255,255, and a valid RGB48 value would be 16384,32768,65535.

When an interpretation of STRING is specified, the first line may optionally specify the maximum string length of the palette values. This value must be a positive integer. If no string length is explicitly specified, a default of 32 will be assumed.

STRING palette values may consist of any arbitrary text, except for the newline character.

GRAY palette values consist of a single integer between 0 and the maximum value of the data type.

All lines after the first are key-value pairs. Palette keys must be organized in ascending order, but they are not required to be contiguous - that is, not all numbers in the series must be present. All absent palette keys look up to 0 or an equivalent value, such as 0,0,0 for RGB or an empty string for string palettes.

Examples

Usage Notes

Choosing a Raster Transformer

FME has an extensive selection of transformers for working with raster data. They can be generally categorized as working with whole rasters, bands, cells or palettes, and those designed for workflow control or combining raster with vector data.

For information on raster geometry and properties, see Rasters (IFMERaster).

Configuration

Input Ports

Output Ports

Parameters

Editing Transformer Parameters

Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.

For more information, see Transformer Parameter Menu Options.

Reference

Processing Behavior

Feature-Based

Feature Holding

No

Dependencies None
Aliases  
History  

FME Community

The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.

Search for all results about the RasterPaletteAdder on the FME Community.

 

Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.