Exercise 3: Creating subtypes and attribute domains

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data for Desktop Goal: Create a geodatabase domain, create subtypes, and define default values for the subtypes.

One of the advantages of storing your data in a geodatabase is that you can define rules about how the data can be edited. You will define these rules by creating a new attribute domain for lateral diameters; creating subtypes for the Laterals feature class; and associating the new domain, existing domains, and default values with fields for each subtype.

Attribute domains are rules that describe the legal values of a field type. Multiple feature classes and tables can share attribute domains stored in the database. However, not all the objects in a feature class or table need to share the same attribute domains.

For example, in a water network, suppose that only hydrant water laterals can have a pressure between 40 and 100 psi, while service water laterals can have a pressure between 50 and 75 psi. You would use an attribute domain to enforce this restriction. To implement this kind of validation rule, you do not have to create separate feature classes for hydrant and service water laterals, but you would want to distinguish these types of water laterals from each other to establish a separate set of domains and default values. You can do this using subtypes.

To learn more about subtypes and attribute domains, see A quick tour of subtypes and A quick tour of attribute domains.

Creating an attribute domain

You will use ArcCatalog to create a new coded value attribute domain. This new domain will describe a set of valid pipe diameters for your new Laterals feature class.

Steps:
  1. Right-click the Montgomery geodatabase and click Properties.

    This opens the Database Properties dialog box.

  2. Click the Domains tab.
  3. Click the first empty field under Domain Name and type LatDiameter for the name of the new domain.
  4. In the Description field, type Valid diameters for water laterals.
  5. You will now specify the properties of the domain. These properties include the type of field this domain can be associated with, the type of domain it is—range or coded value, the split and merge policies, and the valid values for the domain.

    A range domain describes a valid range of numeric values, and a coded value domain describes a set of valid values. In this case, you will create a new coded value domain.

    All domains also have split and merge policies. When a feature is split or merged, ArcGIS looks to these policies to determine the values for a particular attribute of the resulting feature or features.

  6. Under Domain Properties, click the drop-down for the Field Type and click Float.

    This defines the data type of the column to which the domain can be applied.

  7. Click the drop-down for the Domain Type and click Coded Values.
  8. Type the valid values, or codes, for the coded value domain, and for each code, you will provide a user-friendly description. As you will see later in the tutorial, ArcMap uses the user-friendly description, not the code, for values of fields that have coded value domains associated with them.

  9. Click the first empty field in the Code column under Coded Values: and type 13.
  10. Click the Description field beside it and type 13" for the code's description.
  11. Add the following coded values to the list:

    Code

    Description

    10

    10"

    8

    8"

    6

    6"

    4

    4"

    3

    3"

    2.25

    2 1/4"

    2

    2"

    1.5

    1 1/2"

    1.25

    1 1/4"

    1

    1"

    0.75

    3/4"

    -9

    Unknown

  12. Click OK to close the Database Properties dialog box.

    This domain has been added to the geodatabase.

Creating subtypes and associating default values and domains

Now you will create subtypes for the Laterals feature class and associate default values and domains with the fields for each subtype. By creating subtypes, not all the water lateral features need to have the same domains, default values, or (as you will see later in the tutorial) connectivity rules.

Steps:
  1. Double-click the Water feature dataset in the Montgomery geodatabase to open it.
  2. Right-click the laterals feature class and click Properties.

    This opens the Feature Class Properties dialog box.

  3. Click the Subtypes tab.
  4. You will now specify the subtype field for this feature class. The subtype field contains the values that identify to which subtype a particular feature belongs.

  5. Click the Subtype Field drop-down arrow and click TYPECODE.
  6. You will now add subtype codes and their descriptions.

    When you add a new subtype, you assign default values and domains to some of its fields.

  7. Click the Description field next to subtype code 0 under Subtypes and type Unknown for its description.
  8. Under Default Values and Domains, click the Default Value field next to the H_CONFID field and type 0 for its default value.
  9. Set subtype codes

  10. Type 0 for the default value of the DEPTH_BURI and RECORDED_L fields.
  11. For the WNM_TYPE and PWTYPE fields, type WUNKNOWN as the default values.
  12. Click the Default Value field next to DIAMETER field and type 8 for the default value.
  13. Click the Domain drop-down list for the DIAMETER field and click LatDiameter to set it as the default attribute domain for the Unknown subtype.

    Choose domain for DIAMETER field

  14. Click the MATERIAL field and type DI for the default value.
  15. Click Material in the Domain drop-down list for the MATERIAL field.

    Set default value and domain for a subtype

  16. Add the following subtypes:

    Subtype code

    Description

    1

    Hydrant laterals

    2

    Fire laterals

    3

    Service laterals

  17. For all three new subtypes, set the default values and domains for the DEPTH_BURI, RECORDED_L, DIAMETER, and MATERIAL fields for each of these new subtypes the same as you did for the Unknown subtype.
  18. For the Hydrant laterals subtype, set the WNM_TYPE and PWTYPE fields to WHYDLIN.
  19. For the Fire laterals subtype, set the default values of the WNM_TYPE and PWTYPE fields to WFIRELIN.
  20. For the Service laterals subtype, set the default values of the WNM_TYPE and PWTYPE fields to WSERVICE.
  21. When adding new features to a feature class with subtypes in the ArcMap editing environment, if you don't specify a particular subtype, the new feature will be assigned the default subtype. Once you have added all the subtypes for this feature class, you can set the default subtype from those you entered.

  22. Click the Default Subtype drop-down arrow and click Service laterals to set it as the default subtype.

    Choose Service laterals as default subtype

  23. Click OK.

You have now added behavior to the geodatabase by adding domains and creating subtypes.

Now you will add some additional behavior to the geodatabase by creating relationships. See Exercise 4: Creating relationships between objects.

Related Topics

3/13/2015