Writing Subtypes and Domains
Domain Writing Scenarios
FME has options to write to an existing table or to create a new table, but when a domain is added to the mix there are a number of scenarios:
-
Write to an existing table using an existing domain
-
Write to a new table using an existing domain
-
Write to a new table creating a new domain
These scenarios will be controlled by a series of parameters, namely:
Table Exists Yes/No
Data Type coded_domain/range_domain
Validate Features to Write Yes/No
Writing to an existing table using an existing domain:
1. First, check the settings on the Drop Table First, Truncate Table First.
2. If you wish to validate incoming data, then you must set the writer parameter "Validate Features to Write" to Yes.
Writing to a new table using an existing domain:
1. Drop the existing table if necessary.
2. Next, the attribute that needs to be associated with the domain should be given the data type coded_domain or range_domain (depending on its type) in the schema definition:
3. Click on the Edit button next to code_domain (above), uncheck the "Create Domain" box and fill in the name of the existing domain:
Writing to a new table and creating new domain:
Generally we recommend that you use ArcGIS to create and define domains and simply use FME to associate attributes or validate data when inserting new features. However, creating domains is possible with FME.
The process is the same as for using an existing domain, up to opening the edit dialogue. At the point you would check "Create Domain", enter a new domain name, and define the codes and descriptions for that domain.
Limitations:
-
It is not possible to modify an existing domain
-
Creating a domain is a one-off translation; you would set the data type to coded_domain for the initial process, but subsequent loads of the data should be done with the data type changed back to the actual type (char, integer, etc.)
-
It is not possible to create a domain dynamically; i.e. the domain definition cannot be set as part of the workspace process, but must manually be defined prior to execution
Subtype Writing Scenarios
Because a subtype only applies to a single feature class, it is not possible to create a new table and associate it with an existing subtype. Therefore the scenarios are:
-
Write to an existing table with an existing subtype
-
Write to a new table creating a new subtype
These scenarios will be controlled by a series of parameters, namely:
Table Exists Yes/No
Data Type subtype/subtype_codes
Validate Features to Write Yes/No
Writing to an existing table with an existing subtype:
1. Check the values of the Drop Table First and Truncate Table First parameters
When writing to a table with an existing subtype you do not need to set the writer parameter "Validate Features to Write". A feature with an undefined subtype value will be rejected regardless, with the following error:
ERROR
For the '<ClassName>' table/feature class the subtype code of '<Value>' is not valid for the subtype field '<SubtypeName>'
Writing to a new table and creating a new subtype/domain
Again it's recommended that you use ArcGIS to create and define subtypes, and simply use FME to enter subtype code values when inserting new features. However, creating subtypes is possible with FME.
1. Drop the existing table if necessary.
2. Set the attribute that contains the subtype to type "subtype_codes":
3. Click on the Edit button (above) and enter the subtype codes and descriptions:
Limitations:
Currently FME will not allow you to associate different domains based on a particular subtype. For instance, in the above example, 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 the Small, Medium and Large park subtypes. You would need to create the domain:subtype relationship in ArcGIS to achieve this.