Understanding Feature Types and Attributes
Feature Type: The dataset schema or structure.
Attributes: Information that belongs to a feature. There are user attributes and format attributes.
About Feature Types
Feature type names are listed for each format in the FME Readers and Writers help, in the format's Quick Facts topic. (Click FME Readers and Writers in the FME Workbench help menu.
Some examples of feature types are:
Autodesk AutoCAD DWG/DXF |
layer name |
Bentley MicroStation Design |
level number or level name |
Database formats like Microsoft SQL Server or Esri Geodatabase |
feature class, table name |
Esri Shapefile |
file basename |
A Feature Type is contained within a dataset.
When you create a workspace using a dataset, the Feature Types present in that dataset are shown on the left-hand side of the workspace canvas:
About User Attributes and Format Attributes
FME Workbench supports two types of attributes:
- User attributes are custom attributes that hold domain information about a feature, such as TreeID, Address, and Species. User attributes are always part of the feature no matter which format they are stored in, and are copied when translating from one format to another. User attributes may come from a source dataset, or may be created as-needed within FME. Not all formats accept user attributes and the ones that do sometimes put restrictions on them. Each user attribute is defined by its name, data type, width, and number of decimal places.
- Format attributes are specific to a format's schema. Some examples are: autocad_block_name and xlsx_row_id. They are not generically supported by FME and will change when translating to a different format. In general, format attributes are designed for translations to and from the same format, although advanced users may find them useful for writing to other formats when using customized workspaces.
A particular set of format attributes has the prefix fme_. These attributes represent the data as it is perceived by FME and are sometimes known as FME attributes or generic FME attributes.
Both user attributes and format attributes are most visible when viewing a dataset in the FME Data Inspector or Visual Preview.
Format Attribute Examples
The color of a feature is the simplest example of a format attribute. However, there are many more, all of which vary in their degree of complexity. Some examples of format attributes include the following.
- fme_basename – Contains a dataset's filename without the path or extension. For example, if you read two files, image1.tif and image2.tif, two features are produced: one with an fme_basename value of image1, and one with a value of image2. If these two features are then written to a PNG writer when fanning out on fme_basename, two new files would be produced: image1.png and image2.png.
- fme_dataset – Contains the path of the dataset, a URL, or the name of a database.
- fme_feature_type – Contains a dataset's original features (for example, a file, feature class, database, or table).
- Rotation – Many features possess a degree of rotation around the Z axis. This rotation is also stored as a format attribute; for example, fm0_rotation (the rotation of a feature in GeoMedia format).
- Subtype – For a format that supports subtypes (a type of built-in lookup table), the value corresponding to a subtype code may be placed as a format attribute; for example, geodb_subtype_name (the subtype field for the Esri Geodatabase format).
- Raster Pyramid – Raster features are handled in a slightly different way to vector features, with one of these differences being a greater reliance on format attributes. Raster pyramid details are often stored or set in format attributes. For information about FME and raster features, see Rasters.
Exposed and Unexposed Attributes
In the feature type dialog of a reader or writer, attributes can be Exposed, or made "visible."
Exposed attributes from a reader feature type become part of the workspace, which means you can access them in transformers and set them to particular values. By default, user attributes are exposed, because in most cases, you will be primarily interested in working with those attributes in a workspace. Format attributes are usually unexposed; however, for advanced users, exposing format attributes allows a variety of special things to be done with formats, such as setting line thickness, creating special entities, and setting particular bits or bytes. For more information, see Controlling Features with Format Attributes.
In addition to format attributes, unexposed attributes can originate from dynamic workflows or when working with JSON or XML data. For example, this article in the FME Community discusses how to deal with attributes that are unknown to the schema in a dynamic workflow. Some transformers, such as XMLFlattener, have settings to expose attributes.
When viewing attributes in the Feature Information window, exposed attributes show their FME Data Types; unexposed attributes do not.