Understanding Feature Types and Attributes
Feature Type: The source dataset schema or structure.
Attributes: Information that belongs to a feature. There are user attributes and format attributes.
About Feature Types
Every format used by FME identifies features through a classification scheme. This classification is known in FME as a feature type. Feature types are used to differentiate between different types of features (for example roads, rivers, buildings, contours).
Some examples are:
- In MicroStation Design File (DGN) format, each level is a Feature Type.
- In AutoCAD Drawing File (DWG) format, each layer is a Feature Type.
- In Smallworld format, each class is a Feature Type.
- In Esri Shapefile format, each file basename (*.shp file) is a Feature Type.
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 parcel_identifier, owner_name, and date_surveyed. User attributes are always part of the feature no matter which format they are stored in, and hence persist 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 sde30_justification. They are not generically supported by FME and will change when translating to a different format. You can "expose" or make them visible so that you can set them to particular values and connect them to other format-specific attributes. 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. Format attributes allow a wide variety of special things to be done with formats, such as setting line thickness, creating special entities, and setting particular bits or bytes.
WARNING: Avoid naming user attributes with the prefix fme_. FME may not recognize a user attribute prefixed with fme_ because FME uses this prefix to process many format attributes. As well, to prevent similar conflicts, avoid naming user attributes with the same names as other format attributes.
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 with the FME Data Inspector.
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.
Note: In order for attributes fme_basename and fme_dataset to be read, they must be explicitly exposed in the reader feature type or the FeatureReader transformer.
- 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 sort 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 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. Details of Raster Pyramids are often stored or set in format attributes; for example, oracle_raster_pyramid_type (the type of pyramiding to be applied when writing raster data to an Oracle database).