FME Version
Introduction
Aliases are alternative names given to fields in a dataset that are often more descriptive than the actual field name. Most users of FME who work with a geodatabase will want to be able to create or maintain field aliases within their datasets. When adding a file geodatabase to a workspace, alias control can be found under Schema Attributes > Alias Mode.
Alias Mode controls how geodatabase aliases are used.
- None: Aliases are ignored.
- Replace Attribute Names with Aliases: Attributes on feature types will be named based on their aliases rather than their official names. A geodb_feature_class_alias attribute will be included on each feature. Use this mode when the target format should create feature types using aliases as attribute names.
- Expose Aliases as Metadata Attributes: For each attribute read, a second <name>_alias attribute will be added that stores the alias for the attribute in question. A geodb_feature_class_alias attribute will also be included on each feature. Use this mode when the target format is geodatabase and the aliases should be preserved during feature class and table creation.
Requirements
The Esri Geodatabase (File Geodb) reader/writer used in the following example requires that a licensed version of ArcGIS be available to the user. For more information on required ArcGIS license levels, please see Required ArcGIS License Types for FME Geodatabase Formats.
Source Data
Community Centres (Esri File Geodatabase Feature Class)
In the above image, we see a visualization of the Community Centres feature class and its accompanying attributes containing values for Name, Address, and Website URL of the various community centres located in the city of Vancouver. By examining the properties of this feature class, one can see that field aliases are present in the data.
Step-by-step Instructions
1. Read Source Data
Open a blank workspace in FME Workbench. Add in an Esri Geodatabase (File Geodb) reader to the canvas and browse to the CommunityMap.gdb dataset, which can be downloaded from this article under the Files section. Before adding the reader, open the Parameters.
In the Parameters, click on the ellipsis next to Table and select Community Centres. Then expand the Schema Attributes section and change Alias Mode to Expose Aliases as Metadata Attributes. By exposing the aliases as metadata, a <name>_alias attribute will be added to the incoming data. This attribute will be used to store the alias value for the corresponding attribute. Click OK twice to add the reader.
2. Alter Alias Values
Next, we want to modify the alias values. Add an AttributeManager to the canvas and connect it to the Community Centres reader feature type. In the AttributeManager parameters, simply type in the <name>_alias attributes you wish to change under Output Attribute and set the Attribute Value to contain the altered value you wish to write to the destination alias definition. Enter in the following attributes:
Output Attribute | Attribute Value |
---|---|
CentreName_alias | Name |
CentreAddress_alias | Address |
CentreURL_alias | URL |
Feature Class alias: you can also set the feature class alias. Set the format attribute geodb_feature_class_alias to the alias name.
3. Write Alias Values to Destination Geodatabase
Now we can write out the data. Add an Esri Geodatabase (File Geodb) writer to the canvas and browse to a location to save the dataset. Set the Feature Class or Table Definition to Copy from Reader and then click OK.
Once the writer feature type is added to the canvas, connect it to the AttributeManager. As an optional step, if you wish to write the Community Centres data to a feature dataset, open the writer feature type parameters, and under Table Creation Parameters, type "Community" for Feature Dataset.
4. Save and Run the Workspace
Save and run your workspace. You can view the new alias names in ArcMap.
Advanced
FME is able to create attribute aliases for features read into the workspace that do not have aliases. This is possible if there is an additional attribute with the same name as the original attribute and is suffixed with "_alias". The value of that attribute will be used as the alias on table creation.
For example, there is an attribute named CentreAddress and there is another attribute named CentreAddress_alias with a value of Address. The value of CentreAddresss_alias will be used as the alias of CentreAddress (alias: Address). This only needs to occur on the first feature.
Data Attribution
The data used here originates from data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.