Working with Geodatabase Subtypes: Writing A Subtype

Liz Sanderson
Liz Sanderson
  • Updated

Introduction

A subtype defines aspects of a geodatabase schema that relate to data classification. In other words, instead of creating separate feature classes for a set of features, a subtype defines a subset of features within a single 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 with other feature classes in the geodatabase the way a domain can.

Reading Subtypes

When reading a Geodatabase, FME has an option to "Resolve Subtypes".

ReaderSubtype.png

When this option is checked, the format attribute geodb_subtype_name will be populated with the descriptive value contained in the subtype definition.

Writing Subtypes

When Creating Subtypes, we recommend using a Geodatabase Template as described in How to Use an Esri Template. This is generally easier and more flexible than defining subtypes within FME feature types. 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 the following scenario:

  • Write to an existing table containing an existing subtype.

The above scenarios will be controlled primarily by the following parameters:

  • Validate Features to Write parameter: Yes / No

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.

Video

Scenarios

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 the 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>'

Limitations

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.

Scenario 2: Writing to a new table and creating a new subtype 

Source Data

Parks (MapInfo TAB - MITAB)

ParksSource.png

Step-by-step Instructions

1. Read Source Data

In FME Workbench, open a blank workspace. Add a reader to the canvas and set the following:

  • Format: MapInfo TAB (MITAB)
  • Dataset: Park.tab
    • Click on the ellipses to navigate to the file location on your computer

Click OK.

ParksReader.png

2. Calculate Area

Next, we will calculate the area of each park polygon. Add an AreaCalculator to the canvas and connect it to the Parks reader feature type. We can accept the default parameters.  The calculated area will be stored in an attribute named _area.

3. Map Calculated Values to Subtype Codes

The AttributeRangeMapper will be used to map values coming from the _area attribute (created for the subtype codes we will apply to the subtype definition. The code applied will depend on whether the initial values fall within a specified range. Add an AttributeValueMapper to the canvas and connect it to the AreaCalculator. Open the parameters, set the Source Attribute to _area, then change the Output Attribute to ParkSize.  For the Range Lookup Table, enter the following values:

From To Output Value
  10000 1
10000 1000000 2
1000000   3

AttributeRangeMapper.png

4. Write Features & Writer to Subtype Field

Add an Esri Geodatabase (File Geodb) writer to the canvas and browse to a location to save the output geodatabase. Set the Feature Class or Table Definition to Import from Dataset, then open the Parameters. 

Writer.png

In the Parameters, enable Overwrite Existing Geodatabase, and then set the Template File Geodatabase to Subtypes.gdb. Click OK twice to finish adding the writer. 

WriterParams.png

In the Import Writer Feature Types dialog, navigate to the template geodatabase (Subtypes.gdb), then click OK. 

ImportWriter.png

Since there is only one feature class in the template geodatabase, it will get added automatically. Connect the Parks writer feature type to the AttributeRangeMapper. 

5. Define Table Handling to Update 

Now we need to define how the table will be handled. We already have 80 features with subtypes attached, and we are only adding attributes; we will need to update the incoming features instead of creating new ones. Open the Parks writer feature type parameters. In the General section, set Feature Operation to Update, Table Handling to Use Existing, and Match Columns to ParkID, then click OK. 

UpdateExisting.png

6. Save and Run the Workspace

Save and run the workspace. View the output geodatabase in ArcMap to confirm the subtypes were mapped correctly. 

OutputArc.png

OutputArcCat.png

Data Attribution

The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.