Converts the existing schema (data model) of features to a new structure, based on mappings defined in an external lookup table.
This technique is very useful when the mappings are potentially complex or when they need to be maintained by someone who is not familiar with FME. Using an external lookup table to define these mappings simplifies the completion of these tasks.
The schema mapping lookup table, used by the SchemaMapper transformer, defines a series of conditions that are to be met (filters), and a series of actions that will be executed when the conditions are met.
If an incoming feature matches the rules in any row of the table, the potential actions of the transformer on that feature are listed by type as follows:
Map Feature Types:
Feature types – as defined by fme_feature_type – are mapped from their existing value, to one which defines the new feature type. For example:
Roads → Center Lines
One or more attributes on the feature are mapped by renaming their existing attribute name (s) to a new one. For example:
Name_of_Road → RoadName
Set New Attributes:
A new attribute is created whose name and value are defined in a lookup table.
Features that have an action carried out on them are output via the Mapped port. Otherwise, they are output via the Unmapped port.
In addition to the feature type, the geometry of each feature is left untouched.
Features output through the Mapped port will receive a new attribute that specifies which rows from the schema mapping table that were applied to the feature. The rows are specified as a comma-separated string (e.g., '3,4,5'). This attribute is specified by the Selected Row Attribute parameter, and can only be changed from within the Navigator pane. Setting this parameter to a blank value will prevent the attribute from being added to features.
You can use the SchemaMapper for:
Domain Mapping: where attributes values can be remapped according to a well-defined domain or lookup table. For example:
- Primary Route → US Highway
- Secondary Route → Interstate Highway
- Primary Route → County Road
Dynamic Translations: where workspaces are created to handle any data structure
Automated Schema Mapping: where the manual connections between source and destination schemas are done automatically using an external lookup table.
Note: A schema mapping table (domainSchema.csv) is often derived from a database metadata document such as Esri's XML database schema description, which can be exported from ArcCatalog for any selected geodatabase (Export > XML Workspace Document > Schema Only).
Example: Using the SchemaMapper transformer
The following example describes a typical scenario
Feature Type Mapping
Using an external lookup table (.csv file), you can map feature types to simplify a schema by mapping the old feature type to a new feature type:
|Old Feature Type||New Feature Type|
Using an external lookup table, you can map attributes to new names:
|Old Attribute||New Attribute|
You can use filters to set your mapping rules. For example, if you want to map an “old pipe type” to a “new pipe type” You can set the rule (filter) according to the size of the pipes:
|Old Pipe Type||Pipe Size Attribute||Pipe Size||New Pipe Type|
Example Using Feature Type Mapping and Filtering
You can use the SchemaMapper wizard to define the filters and the type of mapping that you need. You accomplish this task by creating actions to be executed on the source schema.
To open the SchemaMapper wizard, click the Properties button of the transformer. The SchemaMapper Parameters dialog opens.
- Specify the format and location of the schema mapping table (lookup table) to be used. You may want to edit format parameters but you can use the defaults that Workbench provides. Click Next.
- If a dataset has more than one table, specify the table to be used. Click Next.
- On the Create Actions pane, click Add and select the action type. For this example, we'll select Feature Type Map.
- Select the Source and Destination Feature Type Fields. You can show/hide the table columns, and refresh the contents.
- Click OK to return to the Create Actions pane, which now shows the Feature Type Map action you just set.
Note: To transform your source schema to a new schema, you can create more than one action depending on the mapping rules that you want to apply to the existing schema.
- To add another action, select from the Add drop-down menu. In this example, we'll select Filter to display the Create Filter dialog:
- Select the table columns in the Attribute Name and Value Fields. By default, Blank Attribute Values are ignored but you can choose to include them.
- Click OK to return to the Create Actions dialog. The Action column now shows two actions: Map Feature Types and Filter Features:
- Click Finish to set the SchemaMapper parameters.
- For a good basic introduction to the SchemaMapper, see Crouching Schema Hidden Dragon.
- This FME Knowledge Center article contains descriptions and examples.
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.
FME Licensing Level
FME Professional edition and above
Search FME Knowledge Center
Search for samples and information about this transformer on the FME Knowledge Center.