官术网_书友最值得收藏!

  • ArcGIS for Desktop Cookbook
  • Daniela Cristiana Docan
  • 1050字
  • 2021-08-06 19:36:46

Creating domains

The domains define the valid values for the attribute fields of feature classes or non-spatial tables. The domains are properties of a geodatabase, and obviously are stored at the geodatabase level. In a feature class/table, an attribute field can have one or many domains associated with it. The multiple domains associated with a field are based on the existing subtypes that you have already defined for a feature class. A domain can be associated with one or many attribute fields of one or more feature classes from a geodatabase.

There are two domain types: Range and Coded Values. A range domain defines minimum and maximum values and can be used only by the numeric and date field types. A coded domain can be used by the numeric, date, and text field types and defines an explicit list of valid values. Every valid value has a code and a description. A domain defines the attribute behavior when a feature is split or merged in ArcMap using the Split policy and the Merge policy.

Note

For more details about domains, please refer to Geodata/Data types/Domains from ArcGIS help (10.2) online.

Getting ready

Let's continue to work with geodatabase schema by defining valid values for the attribute fields of feature classes that you created in the Creating a feature class recipe. You will create the domains in the geodatabase Properties.

In the Database Properties dialog, the Domains section has three main sections:

  • Domain Name | Description: This defines domain name and description
  • Domain Properties: This sets the domain properties, such as the data type, domain type and split/merge policy
  • Coded Values: This defines the codes and descriptions

How to do it...

Follow these steps to create domains using the ArcCatalog context menu:

  1. Start ArcCatalog. In Catalog Tree, go to <drive>:\PacktPublishing\Data\MyGeodatabase\Topo5k.gdb. Right-click on the Topo5k.gdb file geodatabase, and select Properties | Domains.
  2. In the first cell from the Domain Name column, type dBM. For the Description column, type Building material. In the second section, Domain Properties, for the Field Type tab, choose Long Integer from the drop-down list. For Domain Type, select Coded Values from the drop-down list. For Split policy, select Duplicate and for Merge policy, leave Default Value. You will establish the default values later in this recipe. In the Coded Values section, add the following codes and descriptions:
  3. To save changes, click on Apply from time to time. You should see something similar to the following screenshot:
    How to do it...
  4. Create a new domain named dStories with Description of Number of stories. In the Domain Properties section, for the Field Type option, choose Long Integer. For Domain Type, select Range from the drop-down list. For Minimum value, type 1, and for Maximum value, type 6. For Split policy, select Duplicate, and for Merge policy, leave Default Value.
  5. Create a new domain named dState with Description: State of building. In the Domain Properties section, for the Field Type option, choose Text. For Domain Type, select Coded Values from the drop-down list. For Split policy, select Duplicate, and for Merge policy, leave Default Value. You will establish the default values later in this recipe. In the Coded Values section, add the following code and description:
  6. To save changes, click on Apply from time to time.
  7. The next domain is dHYC. For the Description column, type Hydrologic category. In the Domain Properties section, for the Field Type option, choose Long Integer. For Domain Type, select Coded Values from the drop-down list. For Split policy, select Duplicate, and for Merge policy, leave Default Value. In the Coded Values section, add the following code and description:
  8. Create a last domain dUnkn. For the Description column, type Unknown Text. In the Domain Properties section, for the Field Type option, choose Text. For Domain Type, select Coded Values from the drop-down list. For Split policy, select Duplicate, and for Merge policy, leave Default Value. In the Coded Values section, you will add the code and description. For the Code column, type Unkn, and for Description, type Unknown.
  9. Click on Apply to save changes. Click on OK to close the Database Properties window.
  10. Right-click on Topo5k.gdb, and navigate to Properties | Domains to inspect the results.

How it works...

At step 2, for Split policy, you selected Duplicate. When you split a building made of Brick material (domain code: 2) during the edit session in ArcMap, you will have two buildings made from bricks. For Merge policy, you selected Default Value. Let's suppose you already established the Default Value option for the BM (Building material) field to 0. When you merge two buildings made of Brick material (domain code: 2) during the edit session in ArcMap, you will have two buildings made of Unknown material (domain code: 0). The range and coded values can be validated in the ArcMap edit session using the Validate Features option from Editor present in the Editor toolbar. The Validate Features option helps you to find mistaken attribute values in the sense that it is not a valid value.

There's more...

To create a new coded value domain for a file geodatabase, based on a table that contains the defined codes and descriptions for a domain, you can use the Table To Domain tool from ArcToolbox. In ...\Data\DesigningGeodatabase\LandUseDomains folder, you have five dBASE tables corresponding to the following domains: dArable, dPasture, dMeadow, dVineyard, and dFruitOrchard.

Follow these steps to create more domains for your file geodatabase using ArcToolbox:

  1. Select ArcToolbox from the Standard toolbar. Navigate to Data Management Tools | Domains, and double-click on the Table To Domain tool. Set the following parameters:
    • Set the Input Table parameter as ...\Data\DesigningGeodatabase\ LandUseDomains\Arable.dbf
    • Set the Code Field option as CodeArable
    • Set the Description Field option as Descript
    • Set the Input Workspace field as ...\Data\MyGeodatabase\Topo5k.gdb
    • Set the Domain Name field as dArable
    • Set the Domain Description (optional) field as Land Use domain from table
    • Accept default option for the Update Option (optional) field
  2. Click on OK to close the Table To Domain dialog.
  3. Open the Database Properties dialog for the Topo5k.gdb feature class to check the subtypes you just added. Repeat step 1 to add the dPasture, dMeadow, dVineyard, and dFruitOrchard domains.

See also

  • In the Using subtypes and domains together recipe, you will learn how to combine subtypes and domains for the feature classes you just created
主站蜘蛛池模板: 额济纳旗| 藁城市| 田东县| 清丰县| 四子王旗| 盐城市| 武功县| 蒙城县| 潼关县| 潞城市| 措勤县| 顺昌县| 开鲁县| 西安市| 和龙市| 昔阳县| 电白县| 扎囊县| 抚松县| 岱山县| 綦江县| 杂多县| 上杭县| 西峡县| 读书| 全州县| 山丹县| 寻甸| 兴安盟| 民县| 沂源县| 桑日县| 昌吉市| 改则县| 乐安县| 厦门市| 鲜城| 兴仁县| 寿阳县| 旬阳县| 宁乡县|