A subtype defines aspects of a Geodatabase schema that relates to data classification. In other words, instead of creating different feature classes for a set of features, a subtype functions as a way to define a subset of features within an individual Geodatabase feature class. An attribute in the feature class stores integer values that define the subtype, and a subtype table contains definitions for the corresponding integer value. For instance, a table named “Road” may have an attribute field called "Condition", whose values map to a subtype containing values good, moderate, and bad.
In general, each table can have only one subtype, all codes must be unique and be valid integers, and all code:description pairs must be unique.
It should be noted that a subtype is specific to a particular feature class. Therefore, it cannot be shared by other feature classes in the Geodatabase in the way that a domain can be shared.
When reading a Geodatabase, FME has an option to "Resolve Subtypes".
When this option is checked, the format attribute geodb_subtype_name will be populated with the descriptive value contained in the subtype definition.
Due to the fact that a subtype can only apply to a single feature class, it is not possible to create a new table and associate it with an existing subtype. As such, when writing Geodatabase subtypes, the workflow requirements will fall under one of two scenarios:
- Data Type: subtype / subtype_codes
- Validate Features to Write parameter: Yes / No
Despite the scenarios mentioned, it should be noted that using an XML Workspace document (containing the required subtype definitions) as a template on a Geodatabase writer, is an efficient and highly recommended means of writing Geodatabase subtypes. For more information on importing an XML document with a schema, please see the Geodatabase Writer documentation.
Scenario 1: Writing to an existing table containing an existing subtype
No additional work is required to write to an existing table with an existing subtype. It’s not even necessary to set the writer parameter “Validate Features to Write” in order to validate subtype value. A feature with an undefined subtype value will be rejected anyway, with the following error:
For the '<ClassName>' table/feature class the subtype code of '<Value>' is not valid for the subtype field '<SubtypeName>'
Scenario 2: Writing to a new table and creating a new subtype
It should be noted that we generally recommend that you use ArcGIS to create and define subtypes, using FME to enter subtype code values when inserting new features. However, creating subtypes is possible with FME. The process is to define an attribute for use as a subtype, setting that attributes data type to either subtype or subtype_codes in the schema definition of the destination Geodatabase.
The subtype_codes data type allows the user to define a code number and description for the subtype. Its edit dialog looks like this:
Any attribute that does not adhere to one of the defined values will result in the translation failing with an error.
The subtype data type has only a single field in its editing dialog:
FME will create a unique code number for each incoming value. This option might be useful when you do not know what particular values the incoming data might hold.
At the time of writing, FME will not allow you to associate different domains based on a particular subtype. For instance, you would not be able to set range domains of 0-50,000; 50,000-100,000; 100,000-250,000 and apply them to a subtype definition containing the values of Small, Medium, and Large. In order to achieve this, you would need to create the domain:subtype relationship in ArcGIS.
The following example demonstrates Scenario 2: Writing to a new table and creating a new subtype.
Parks (MapInfo TAB - MITAB)
In the above image, we see a visualization of the source Parks MapInfo TAB file with the corresponding data and attributes.
1. Read Source Data
Park feature geometry is read from the source TAB file using the MapInfo TAB (MITAB) reader. The data in this file will be used to calculate Park area values that will be subject to the subtype definition in the destination Geodatabase.
2. Calculate Area & Map Area to Subtype Codes
The AreaCalculator transformer is used to calculate the area of each polygon contained in the source data. Add the AreaCalculator to the canvas - the default parameters for the AreaCalculator will be sufficient. The value for the calculated area will be stored in an attribute named _area.
The AttributeRangeMapper will be used to map values coming from the _area attribute (created with the AreaCalculator) to the subtype codes we will apply to the subtype definition. The code applied will be based on whether the initial values fall into a specified range. Add the AttributeValueMapper to the canvas and open the parameters dialog. Select _area as the Source Attribute and for Output Attribute type in "ParkSize". For the Range Lookup Table, enter the following values:
When complete, the AttributeRangeMapper parameters dialog should resemble the following image:
3. Write Features & Create Subtype
Add the ESRI Geodatabase (File Geodb ArcObject) writer to the workspace, copying the schema from the reader and specifying the output Geodatabase to which the data will be written (i.e. Subtypes). Once added, double click on the writer and, under the General tab, set the geometry to be geodb_polygon using the drop down menu. Next, click on the User Attributes tab and, under Name, add an attribute called ParkSize and set the Type to subtype_codes.
Click on the Edit button and the Subtype Codes dialog window will open. Enter the codes and corresponding descriptions for the subtype definition.
Click OK and then save and run the workspace.
* The ESRI Geodatabase (File Geodb ArcObject) reader/writer used in the above 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.
2 People are following this .