FME Transformers: 2024.2
FME Transformers: 2024.2
FeatureColorSetter
Assigns colors to incoming features.
Example
In the example below, there are unique feature counts and then IDs.
If aggregates are not important, only 3 colors are required:
Feature | Adjacent to Areas |
---|---|
2,20 | 1, 3, 6 |
8,20 | 3 |
9,20 | 4 |
If, however, ID 2,20 is treated as an aggregate, then 4 colors are required and the pre-existing ID attributes must be supplied.
Feature | Adjacent to Areas |
---|---|
20 | 10, 30, 40, 60 |
Feature | Not Adjacent to Area |
20 | 50 |
Usage Notes
- A TopologyBuilder placed before the FeatureColorSetter can help you build a list of adjacent areas.
- An AttributeFilter or another FeatureColorSetter can be used to manipulate the Color ID attribute.
Configuration
Input Ports
Input
Input features to be colored.
Note that features must be topologically clean if you are using the Map Coloring schemes.
Output Ports
Colored
Features with new color attributes.
<Rejected>
Features are output through this port when the FeatureColorSetter is passed an inappropriate input type and cannot apply the chosen color scheme to the input. The two color schemes Map Coloring: Five Color and Map Coloring: N Color (Fast) will produce rejected output if the FeatureColorSetter is passed a non-polygon input.
Parameters
Group Processing (Optional)
Group By |
The default behavior is to use the entire set of input features as the group. This option allows you to select attributes that define which groups to form – each set of features that have the same value for all of these attributes will be processed as an independent group. The effect of using a Group By attribute varies according to the Color Scheme chosen. It is most effective when used in conjunction with either of the Map Coloring schemes, where color assignments will be made within each group, and features not within the current group are ignored for the purposes of color selection. If a Group By attribute is used in conjunction with either of the Random color schemes, random colors are applied within a group. Subsequent groups will be processed using the same set of colors, and so duplicate colors will likely result. To apply random colors but have all features with a common attribute value be the same color, do not use Group By. Instead, use Color Scheme > Random and Randomize Based On > Attributes |
||||
Complete Groups |
Select the point in processing at which groups are processed:
Considerations for Using Group By
There are two typical reasons for using When Group Changes (Advanced) . The first is incoming data that is intended to be processed in groups (and is already so ordered). In this case, the structure dictates Group By usage - not performance considerations. The second possible reason is potential performance gains. Performance gains are most likely when the data is already sorted (or read using a SQL ORDER BY statement) since less work is required of FME. If the data needs ordering, it can be sorted in the workspace (though the added processing overhead may negate any gains). Sorting becomes more difficult according to the number of data streams. Multiple streams of data could be almost impossible to sort into the correct order, since all features matching a Group By value need to arrive before any features (of any feature type or dataset) belonging to the next group. In this case, using Group By with When All Features Received may be the equivalent and simpler approach. Note Multiple feature types and features from multiple datasets will not generally naturally occur in the correct order.
As with many scenarios, testing different approaches in your workspace with your data is the only definitive way to identify performance gains. |
Mode
Color Scheme |
Fixed: Manually set a feature's pen and fill colors using the Pen Color and Fill Color parameters. Random: Sets a random color for each incoming feature. Random (Offset): Same as Random, but with the pen color slightly different than the fill color. This gives a good visual result. Gradient: Assigns colors along a gradient between a start and end color, based on an interpolation value. Map Coloring: Assigns colors to areas in a coverage so that adjacent areas are output as different colors. The total number of colors used is kept as small as possible while ensuring that no two adjacent regions receive the same color. When using the Five Color scheme, a maximum of five colors will be used to color the regions. When using the N Color (Fast) scheme, each area is colored with the first available color. Ideally, only a few colors will be used but the total number of colors is not guaranteed. |
||||||||||||||||||||||||||||||||||||||||||||||||
Random Seed |
When Color Scheme is Random or Random (Offset), a seed value may be entered to generate a reproducible color scheme. |
||||||||||||||||||||||||||||||||||||||||||||||||
Randomize Based On |
Color Limit: Enables the Unique Color Limit parameter described below. Attributes: Enables the Randomize By Attributes parameter described below. |
||||||||||||||||||||||||||||||||||||||||||||||||
Randomize By Attributes |
When the Color Scheme is set to Random or Random (Offset) and the Randomize Based On is set to Attributes, use this parameter to group the input features based on the specified attributes. Grouped features will all be colored the same random and unique color. If left empty while enabled, each input feature will be treated as its own group. |
||||||||||||||||||||||||||||||||||||||||||||||||
Unique Color Limit |
When the Color Scheme is set to Random or Random (Offset) and the Randomize Based On is set to Color Limit, use this parameter to set a limit on the number of unique colors randomly selected. The limit can be set to any integer value with a lower bound of 0. If set to 0, then no bound is applied, and there will be no limit to the number of different colors used. When the Color Scheme is set to N Color (Fast), use this parameter to control how evenly the distribution of colors are. If a value greater than 0 is given, greater effort will be put into providing an even distribution across that maximum number of colors. (However, more colors than that limit may be used if no solution can be quickly found at that limit.) If a value of 0 is given, greater effort will be put into finding a solution with the fewest number of colors used, but the distribution across those colors will not be very even. |
||||||||||||||||||||||||||||||||||||||||||||||||
Gradient |
|
General
Pen Color |
When Color Scheme is Fixed, use this parameter to set the pen color (fme_color). If blank, the pen color will remain unchanged and the value of fme_color will be left as is. Specifying Colors Colors may be entered directly or chosen from the color picker via the ellipsis button. Syntax
Colors can be specified by RGB values or hex codes. RGB values may be either 24-bit or decimal (0 - 1). If the value type is unclear, as in (1,1,1), the 24-bit interpretation is used. Hex codes are accepted with or without a hash sign (#).
|
||||||||||||||||||||
Fill Color |
When Color Scheme is Fixed, use this parameter to set the fill color (fme_fill_color). If blank, the fill color will remain unchanged and the value of fme_fill_color will be left as is. Specifying Colors Colors may be entered directly or chosen from the color picker via the ellipsis button. Syntax
Colors can be specified by RGB values or hex codes. RGB values may be either 24-bit or decimal (0 - 1). If the value type is unclear, as in (1,1,1), the 24-bit interpretation is used. Hex codes are accepted with or without a hash sign (#).
|
||||||||||||||||||||
Color ID Attribute |
When Color Scheme is Map Coloring, this is the attribute that contains the output color code. The default is _color_id. Colors are output to the Color ID Attribute as integers (the first color is 0, the second color is 1, etc.). |
||||||||||||||||||||
Pre-existing Area ID Attribute/Pre-existing Neighbor IDs Attribute |
These parameters are used when the Color Scheme is set to Map Coloring. When you provide a Pre-existing Area ID Attribute and Neighbor ID Attributes for each area, you can force the relationships to follow pre-existing mappings. For example, if your data contains aggregates and you know the area to which they belong, you can define that relationship using these parameters. This option is especially useful when the input data contains aggregates and you want to "map" pre-existing IDs to define the relationships. Note If these
parameters are not provided, adjacencies between areas are determined geometrically,
and non-polygon geometries (including aggregates and ellipses) are removed.
Area IDs must be non-negative integers, and neighbor IDs are entered as a comma-separated list. |
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.
How to Set Parameter Values
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.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
Content Types
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
Math functions are available in both editors. | |
Date/Time Functions | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Table Tools
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering
|
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste
|
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
Filter
|
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import
|
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
Reset/Refresh
|
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
Note: Not all tools are available in all transformers.
For more information, see Transformer Parameter Menu Options.
Transformer History
This transformer combines the features of, and replaces, these transformers: NeighborColorSetter, ColorSetter, RandomColorSetter.
FME Community
The FME Community has a wealth of FME knowledge with over 20,000 active members worldwide. Get help with FME, share knowledge, and connect with users globally.
Search for all results about the FeatureColorSetter on the FME Community.
Keywords: AreaFillColorSetter AreaFillColourSetter PenColorSetter PenColourSetter ColorSetter ColourSetter FeatureColourSetter NeighborColorSetter NeighbourColourSetter NColorer NColourer MapColorer MapColourer MapColorizer MapColourizer RandomColorSetter RandomColourSetter