Controlling Features with Format Attributes

Format Attributes are used to control features. To avoid cluttering the workspace, these attributes are not all visible by default. To make them visible is known as “exposing” them, and involves the Feature Type dialog.

You can use format attributes to carry out certain tasks by making the attributes part of the workspace.

 

Exposing Format Attributes

To expose a format attribute, open the Feature Type dialog, and click the Format Attributes tab. Locate and select the Format Attribute to expose. Click OK to make the format attribute available for use in Workbench.

Format attributes might be a single attribute (for example, igds_style) or they might be a list-based format attribute, for example (igds_tag_names{})

Note: Another way to expose format attributes is through the AttributeExposer transformer.

Filtering with Format Attributes

One primary use of format attributes is as a means of filtering and directing source data within a workspace.

For example, suppose features in a source AutoCAD dataset are not divided into different layers as they should be. Because you can determine the proper layer from maybe the color of the feature or the size of a text entity, you can expose the format attributes autocad_color or autocad_text_size, and use them to interpret the correct layer.

Most “filter” transformers can be used to process data in this way.

List Format Attributes

A List attribute is an FME structure that allows multiple values for each attribute. For example, an area of forestry might have a list of tree types (Pine, Oak, Cedar) in which case a list attribute in FME might be something like:

parcelList.treeType{0} = Pine, parcelList.treeType{1} = Oak, parcelList.treeType{2} = Cedar

This is important here because some format attributes can also be a list type of attribute.

In this example, we have exposed the list format attribute igds_tag_names{}.

If we attempt to use that attribute in a Tester transformer, we are prompted to choose which element in the list is to be tested. Because transformer dialogs ask which element in a list is to be used, it is not necessary to have to expose multiple elements solely to get access to a single one.

Transforming with Format Attributes

The other primary use of format attributes is to transform the data itself.

When writing data, FME attributes are turned into format attributes that reflect the data as it is supposed to be written. However, you can override this process by predefining the value of these attributes before they are sent to the writer.

In other words, setting a format attribute may cause a transformation in the data to take place. Either the writer format attribute (here kml_linestyle_color) or the equivalent FME attribute (here fme_color) may be set to achieve the same end.

You can define either attribute because if fme_color is set, it is converted to kml_linestyle_color as normal, and if kml_linestyle_color is set, then FME knows not to overwrite it.

If you manage to define both a format attribute and its FME equivalent, then the format attribute takes precedence and is used. For example, set fme_colorand kml_linestyle_color, and the kml attribute gets priority.

This only really becomes a problem when reading and writing the same format, and the same format attributes exists on both the reader and writer. In that case, use the format attribute – it is not safe to use the fme equivalents.

Transformers for Setting Format Attributes

Setting Format Attributes can be complicated.

Once a format attribute is exposed on a reader feature type, then an AttributeCreator transformer can be used to change its value. But this won’t have any effect unless the translation is reading and writing from the same format.

On the other hand, exposing a format attribute on a writer feature type doesn’t make that attribute available in the workspace in the same way (that is, it is not exposed back upstream).

So, the most common method is to use the AttributeCreator transformer, but actually create the writer attribute and set it. For example, create autocad_block_name and set a value for it.

Used this way, the action is more like a Feature Type parameter; that is, it applies to all features written to that feature type.

Besides setting format attributes manually, there are a number of FME transformers that are designed to be merely a more user-friendly front-end to setting a format attribute.

The FeatureColorSetter (for example) “Assigns color to incoming features”, but in reality all it does is set a new value for the format attributes fme_color, fme_fill_color, etc.

The DGNStyler helps define the symbology of features to be written to a MicroStation Design File. It is really just an easier way of using format attributes.

Similar transformers are: