Mapping Attributes from Reader to Writer
During a translation, the following occurs:
- FME reads the source data and stores information about its features as format attributes. These format attributes reflect the data that is stored in the original Reader Format.
- FME converts the source data’s format attributes into FME Attributes. These FME attributes reflect the source data as the FME internal format would store it.
- FME writes the destination data by creating a new set of format attributes. These format attributes reflect the destination data as it will be stored in the Writer Format.
FME converts from one format to another without having to separately map the source data's format attributes directly to the destination format's attributes for every format. FME converts everything to an FME standard, and then converts it again to the writer format.
The benefit of using generic attributes over format-specific attributes is that they have the same meaning in all the readers and writers that support them. For example, the fme_color and fme_fill_color feature attributes represent the red, green, and blue intensities of a feature. If a format has generic color support, the reader will add both the generic FME color attributes and the format-specific color attributes to features. Writers that support generic color will give precedence to the format-specific color attributes if they are present in addition to the generic attributes.
The most important generic attributes are fme_type and fme_geometry. Both of these relate to the geometry of a feature. The Geometry class represents a feature’s positional information. Feature geometry may consist of points, lines, or areas. Features that contain multiple geometric parts are said to have an aggregate geometry. Features with no geometry are also supported.
The distinction between fme_type and fme_geometry is an important one: fme_geometry indicates the geometry type of the actual coordinates, whereas fme_type specifies how that geometry is to be interpreted. For example, a point geometry type can be interpreted as one of the following FME types: point, arc, ellipse, or text. For more information about the valid combinations of fme_type and fme_geometry for features, see the FME Geometry Model.
Attribute Names
Many formats have restrictions on the structure and format of attribute names. Esri Shape format, for example, permits UPPERCASE names only and has a maximum length of ten characters for attribute names.
When creating a workspace, FME converts attribute names to UPPERCASE in the destination schema if needed. In such a case, attribute connections cannot be implied so FME generates schema mapping that joins source attributes to the destination.
Note, however, that this is just a starting point. Edits to the workspace may break the FME generated schema mapping and, therefore, require you to create your own attribute connections.
Attribute Field Size
Some formats carry restrictions on attribute sizes, for example a maximum length of character field or maximum number in a numeric field. Where possible, FME generates a destination schema that reflects any such limitations.
Attribute Data Types
Different formats support different data types. Even when two formats support the same data type, it is often represented by a different name. In this situation, FME must decide how to map attributes between data types.
FME solves the problem by supporting all of these data types internally within its enhanced data model. A metafile for the reader format instructs FME how to map its attribute data types to the FME model and a second metafile instructs FME how to map its model types to the destination schema.
For example, this is the data type mapping for MapInfo data:
MapInfo Data Type | FME Data Type |
---|---|
char(width) | fme_char(width) |
date | fme_date |
decimal(width,decimal) | fme_decimal(width,decimal) |
float | fme_real64 |
integer | fme_int32 |
logical | fme_boolean |
smallint | fme_int16 |
And this is the data type mapping for Oracle data:
Oracle Data Type | FME Data Type |
---|---|
char(width) | fme_char(width) |
float | fme_real32 |
number(width,decimal) | fme_decimal(width,decimal) |
double | fme_real64 |
integer | fme_int32 |
logical | fme_boolean |
smallint | fme_int16 |
These mappings show that a MapInfo decimal
type attribute becomes an fme_decimal
type in the FME data model, which then becomes a number
data type when written to Oracle.
For more information about data types in the FME data model, see FME Data Types.