RasterPaletteExtractor

Creates a string representation of an existing palette on a raster and saves it to an attribute.

Jump to Configuration

Typical Uses

  • Extracting a palette to be saved to an external file
  • Extracting a palette to apply to other rasters or for use elsewhere in a workspace

How does it work?

The RasterPaletteExtractor receives raster features and copies the palette information to a string attribute. Only one palette may be extracted at a time.

This transformer supports raster band and palette selection. Exactly one palette must be selected on each input raster feature. The RasterSelector can be used to modify selection.

This transformer may be used in combination with the AttributeFileWriter to write a palette to a file.

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

Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.

Defining Values

There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.

Dialog Options - Tables

Transformers with table-style parameters have additional tools for populating and manipulating values.

Reference

Processing Behavior

Feature-Based

Feature Holding

No

Dependencies None
FME Licensing Level FME Professional Edition and above
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 RasterPaletteExtractor on the FME Community.

 

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