Editing Writer Feature Types
Because a writer feature type is simply a definition of what is to be created (in most cases, it does not yet exist), you can edit a destination feature type in a number of ways that are not permitted for source feature types.
See Also
Displaying Feature Type Parameters and Attributes
To display the Feature Type dialog, do one of the following:
- Click the gear icon on the feature type.
- Right-click on a feature type and select Properties from the menu.
- On the menu, select View > Windows > Parameter Editor. On the canvas, select the feature type.
Just like Writers, feature types have their own set of parameters that control how that feature type (layer/table) is being written. These parameters apply only to a single feature type, whereas a Writer parameter applies to all feature types. Writer Feature Type parameters provide a degree of individual control over writing different layers or tables.
You can rename the feature type by simply clicking in the Feature Type name field and typing a new name.
You can also choose to fanout the feature according to the selected attribute name.
Table Qualifier
This prefix is specified in the Table Qualifier field. For example: Owner1.Parks
.
Changing Geometries
When a destination feature type is automatically created by FME, the destination geometry is assumed to be the same as the source dataset. For example, a source dataset containing line features is assumed to lead to a destination dataset containing line features. However, this is not always the case. Transformers within the workspace may be used to alter feature geometry.
If feature geometry will change during the translation, and the destination format demands a strict definition of allowed geometries (Esri Shapefile datasets require this), then the geometry type can be selected here from a drop-down list. This is not only a desirable quality, but vital too, since not to make such a change would lead to error messages in the subsequent translation.
If you are working with a dynamic workspace, the following additional options are available for some writer formats (such as Esri Shapefile and Esri Mapping Specification for CAD):
- From Schema Definition: Geometry type is derived from the source schema.
- First feature defines geometry type: The first feature to reach the writer is used to set the geometry type.
For many formats, all geometries are automatically allowed – in these cases, the Geometry field is disabled.
Dynamic Schema Definition
Used in Dynamic Workspaces.
Other Parameters
Some formats, including most database formats, support additional parameters. For example, when writing to a SQL Server database, there is a feature type parameter that defines the spatial index to create. This is a Feature Type parameter because not every table requires a spatial index, and therefore each feature type needs a way to define it.
For more information about these parameters, click the Help button to open the applicable format's topic in the FME Readers and Writers help.
These parameters allow you to define the attributes that will be associated with this feature type. Attributes can be defined by editing an existing feature type, or when a new feature type is added to a workspace. If a format does not allow user attributes, this tab is not present.
On writer feature types, you can easily add, delete, move, rename, sort, and change attributes’ data types. For some data types, you can define a width (that is, the width of the field). For other data types, you can specify a number of decimal places. If a column is grayed out, then you can't set a width or number of decimal places.
Tip: To quickly remove several attributes at once: Ctrl+click to select them, and then press Delete.
Attributes can be defined in three ways: Automatic, Manual, or Dynamic.
The default option is Manual.
Manual User Attribute Definitions
When Attribute Definition is Manual, the workspace author can manually enter attribute names, select the attribute type, and define cell width, formatting (where applicable), and values. This example shows three attributes that have been defined for an address table:
On the FME Workbench canvas, the feature type looks like this:
To assign a User Attribute value, you can enter a fixed (constant) value, set a conditional value, open an editor, or select User Parameters. This example shows four attributes that have been defined for an address table, including one attribute that has a defined value:
On the FME Workbench canvas, the feature type indicates that the attribute has a defined value.
Automatic User Attribute Definitions
When Attribute Definition is Automatic, FME Workbench automatically copies all of the incoming feature type's attributes, after any attributes are created or removed by transformers, and defines the list of attributes from this copy.
When Automatic is selected, the attribute definition fields are disabled, and you cannot edit them.
Similarly, on the FME Workbench canvas, the feature type is also empty:
What makes the definitions automatic is the action that occurs when a Reader feature type or transformer is connected:
Notice that all of the attributes defined on the Reader feature type are now copied over to the Writer feature type automatically.
Because this operates automatically, if the Reader feature type is removed, and another one is connected, the list of attributes on the Writer feature type will be immediately updated to match. Or, if a second Reader feature type is connected, then the list of attributes updates to become a union of the two types:
Likewise, when transformers that change the composition of attributes are connected to writer feature types, the list of attributes updates accordingly. Here, an AttributeCreator transformer adds attribute Address
, and an AttributeRemover transformer removes attribute SpecialFeatures
. The attribute list on the writer feature type automatically updates:
This is useful because it means that multiple streams of data can be merged into a single feature type, and all attribute definitions are automatically defined.
However, what the Automatic option does not do is handle a scenario where you change the Reader dataset parameter to read data with a different set of attributes. In other words, the Writer attributes will only be defined by what is connected, not what actually exists in the source data. For that scenario, you need Dynamic Attributes.
Dynamic User Attribute Definitions
Specifying Dynamic attributes also causes the Dynamic Schema Definition option (in the Parameters tab) to be selected.
Similar to Automatic, the initial feature type will not contain attributes. And when Reader feature types are connected, the feature type will still not contain attributes. A dynamic feature type truly has no definition in advance. Instead, it dynamically takes its attribute definitions from either the data that is fed to it when the workspace is run, or another set of schema definitions selected by the user.
Differences between Automatic and Dynamic Attribute Definitions
- Automatic Attribute Definition takes its attribute definition from whatever is connected to it in the workspace. If the Source Dataset parameter is changed, it will have no effect.
- Dynamic Attribute Definition is different. If the Source Dataset parameter is changed, a dynamic schema will (by default) take its attribute definition from whatever source data is being read.
These are built-in FME attributes that you can "expose" or make visible so that you can set them to particular values and connect them to other format-specific attributes. Apply to... exposes the attributes for multiple, selected feature types.
Exposing an attribute on the writer side allows it to be set to a value (for example, you might want to set a pen_width or a line_color to appear in the destination data).
This is key to fully using FME. The special attributes' purposes are described in the Feature Representation section of each reader (input) and writer (output) in the FME Readers and Writers manual (available under the FME Workbench help menu). These attributes allow a wide variety of special things to be done with formats (like setting line thickness, creating special entities, setting particular bits or bytes).
To learn more about working with format attributes, see Controlling Features with Format Attributes.
- To open the Change Multiple Feature Types dialog, do one of the following:
- In the Feature Type dialog, click Apply To.
- In the Parameter Editor, click the Change Multiple Feature Types icon .
- By default, all output feature types are listed in the Feature Types to Change field. Click the Browse button to check/uncheck feature types from the feature type list that appears (specify a filter to isolate certain feature types). Click OK to close the list box.
- You can also change the dataset, geometry, fanout settings, or choose format attributes to expose for the selected feature types.
- Click OK to close the Change Multiple Feature Types dialog.
- To confirm the changes to all feature types, including the current one, click OK in the Feature Type dialog. You will be asked to confirm any changes to other feature types. Note that if you click Cancel, none of the changes will be applied.