Editing Geodatabase Domains and Subtypes

If you're writing to Geodatabase, some unique attribute types (field types) will be written out as part of the table.

After you generate your initial workspace, click the User Attributes tab on an output feature type. User attributes contain unique data types that you can further define. Most of the attribute types offered are normal attribute types such as char(n), integer, and date; however, domains and subtypes are unique to the geodatabase.

coded_domain

A coded_domain defines a set of values for an attribute in a geodatabase, and consists of a code and its equivalent value. For example, for a road feature class, the numbers 1, 2, and 3 might correspond to three types of road surface: gravel, asphalt, and concrete. Codes are stored in the geodatabase, and corresponding values appear in the attribute table.

  1. After you click the Edit button beside the Data Type field, the Edit Coded Domain dialog appears.
  2. Enter a domain name (for example, road_type)
  3. Assuming the domain does not already exist in the database, uncheck the box beside Domain already exists in dataset.

If you uncheck the box and the domain does already exist, the Geodatabase writer will validate the definition of the domain and log a message if the definition in Workbench is different than the definition in the geodatabase (but will not overwrite the existing domain).

  1. Select a field type (boolean, char(n), date, double, float, integer, or smallint) from the drop-down list; in this case, you might select integer.
  2. Enter codes and corresponding descriptions. For example, you might enter 1 for gravel, 2 for asphalt, 3 for concrete, etc.
  3. Click OK to set the values.

range_domain

A range_domain defines the range of values for a numeric attribute. For example, the permissible range of values for a lot length might be between 70 and 100 feet.

  1. After you click the Edit button beside the Data Type field, the Edit Range Domain dialog appears.
  2. Enter a domain name (for example, house_age)
  3. Assuming the domain does not already exist in the database, uncheck the box beside Domain already exists in dataset.

If you uncheck the box and the domain does already exist, the Geodatabase writer will validate the definition of the domain and log a message if the definition in Workbench is different than the definition in the geodatabase (but will not overwrite the existing domain).

  1. Select a field type from the drop-down list; in this case, you might select Date.
  2. Enter codes and corresponding descriptions. For example, you might enter 19820101 to 19990101.
  3. Click OK to set the values.

Date attributes must be of the form YYYYMMDD, YYYYMMDDHHMMSS, or HHMMSS. If the last format is used, then the YYYYMMDD portion of the date will be set to 19000101.

subtypes

Subtypes are a subset of features in a feature class or objects in a table that share the same attributes. For example, the features in a vegetation feature class could be categorized into three subtypes: oak, maple, and birch. Creating subtypes can be more efficient than creating many feature classes or tables in a geodatabase.

In the geodatabase, the field must be an integer type in order to be able to create subtypes on it.

For subtypes, descriptions can be supplied as strings, in which case the codes are generated by the Geodatabase writer. For subtype_codes, the input list consists of pairs of codes and corresponding descriptions.

The first code in the list will be used as the default subtype code. If only descriptions are specified, the code created for value1 will be used as the default subtype code. For instance, if you specify subtype_codes 1:a:3:b:4:c:5:d, then 1  (which maps to a) will be used as the default code.

  1. After you click the Edit button beside the Data Type field, the Edit Subtypes (or Subtype Codes) dialog appears.
  2. Enter a subtype description. For example, if a field is named house_type, you might enter descriptions rancher, two-storey. If you're defining subtype_codes, enter a corresponding integer code. Note that the first subtype is always used as the default.
  3. Click OK to set the values.

Notes:

  • Each table can have only one subtype.
  • All the codes have to be unique and valid integers.
  • All the code,description pairs have to be unique.
  • You cannot add subtypes to an existing table. If you do, it will be ignored and the table will use the existing subtype, if one exists.
  • When writing features, the subtype attribute must contain the code (which is stored as an integer by Geodatabase).
  • For detailed information, please see the Esri Geodatabase chapter in the FME Readers and Writers manual.