Editing with Subtypes and Domains
October 26, 2012
A look at Subtypes and Domains
Subtypes• Subtypes are used to classify features within a feature class/table. Users can classify and group features within the feature class by defining subtypes.
For example, a subtype can be used to define certain park types within a park feature class and classify them into 3 categories – Community, Wilderness, and Sports.
Domains• Domains are used to restrict allowable values within an attribute field. There are two types of domains – Range, Coded Values.
Range: A range of allowable values that can be used for a certain field
Coded Values: Placing restrictions to the field using user defined values
For example, a domain can be used to restrict the admission required to enter the parks based on park types.
Before we begin Editing, we will need to prepare the data. Keep in mind that it is important to have properly formatted and structured data prior to carrying out analysis/editing. To follow the example below, please download the data here.
Objectives:
In the following example, we will be editing the Parks feature class. The Parks feature class currently contains polygons that represent 3 different park types (Community, Wilderness and Sports) and each polygon is classified using the field ‘park_type' with values 1, 2, and 3. A new field ‘admission' has been added to allow users to assign an admission value for each park based on park type. To do this, we will first define Subtypes for the Park feature class to group the polygons based on park type. We will also be setting domain and default values to allow users to define the cost of admission for each park based on type.
Part I – Setting Subtypes to organize Parks Types
Our first step in this example is to define Subtypes. Looking at our data, we have 3 distinctive park types (Community, Wilderness and Sports). Before defining subtypes, there are a couple of things to take note of in regards to the feature class properties.
- Subtypes can only be defined within a Geodatabase.
- Subtypes are created based on an attribute field that is either Long/Short integer. The values within the integer field are being used to define the groups within the feature class. (The below image shows the data that we are working with. We will be creating Subtypes using the ‘park_type' field where 1 is Community, 2 is Wilderness, and 3 is Sports).
Procedure
Now that we have defined Subtypes based on park types within the feature class, we would like to create Domains to restrict the values that users can enter within the ‘admission' field.
For example,
The following section will guide us in using the domain for each subtype. We would like to link the domain that we have defined in the previous section to the park type subtypes. Also, we would like to set Default values for the Community Park's admission to 0. When a Default value is defined, any new Community Park features created through Editing within ArcMap will automatically have 0 within their admission field.
Procedure
Now that we have prepared our data by using Subtypes/Domains, we will perform some editing on the Parks feature class. We will be adding 1 of each park type to the feature class and will look at how subtypes/domains can be used to create a more efficient editing workflow. We will also be assigning admission values to features that already exist within the feature class prior to editing new features.
Procedure
- Subtypes/Domains can be defined within a Geodatabase only.
- Subtypes can be defined based on a Short/Long integer attribute field to classify features into groups.
- Each subtype can have its own default value/domain.
- Domains allows user to restrict values to be used within a field with Coded or Range Values.
- Subtypes/Domains encourage a more efficient Editing workflow and reduce potential error when creating new features.
Subtypes• Subtypes are used to classify features within a feature class/table. Users can classify and group features within the feature class by defining subtypes.
For example, a subtype can be used to define certain park types within a park feature class and classify them into 3 categories – Community, Wilderness, and Sports.
Domains• Domains are used to restrict allowable values within an attribute field. There are two types of domains – Range, Coded Values.
Range: A range of allowable values that can be used for a certain field
Coded Values: Placing restrictions to the field using user defined values
For example, a domain can be used to restrict the admission required to enter the parks based on park types.
Park Types | Admission | Domain Type |
Community | $0 | Coded Value |
Sports | Between $5-$10 | Range Value |
Wilderness | $20 | Coded Value |
Objectives:
In the following example, we will be editing the Parks feature class. The Parks feature class currently contains polygons that represent 3 different park types (Community, Wilderness and Sports) and each polygon is classified using the field ‘park_type' with values 1, 2, and 3. A new field ‘admission' has been added to allow users to assign an admission value for each park based on park type. To do this, we will first define Subtypes for the Park feature class to group the polygons based on park type. We will also be setting domain and default values to allow users to define the cost of admission for each park based on type.
Part I – Setting Subtypes to organize Parks Types
Our first step in this example is to define Subtypes. Looking at our data, we have 3 distinctive park types (Community, Wilderness and Sports). Before defining subtypes, there are a couple of things to take note of in regards to the feature class properties.
- Subtypes can only be defined within a Geodatabase.
- Subtypes are created based on an attribute field that is either Long/Short integer. The values within the integer field are being used to define the groups within the feature class. (The below image shows the data that we are working with. We will be creating Subtypes using the ‘park_type' field where 1 is Community, 2 is Wilderness, and 3 is Sports).
Procedure
- Start ArcCatalog and navigate to the downloaded geodatabase directory.
- Right click on the parks feature class to open the Feature Class Properties Dialog.
- Click on the Subtypes tab to open the dialog for creating subtypes.
- Select ‘park_type' from the drop-down list for Subtype Field.
- Click on the field under the Code attribute within the Subtypes area to start entering Subtype Code and Description.
- The ‘park_type' field within the Parks feature class contains values 1, 2, and 3, referring to Community, Wilderness, and Sports respectively.
- Enter the Subtype information as shown in the following diagram by typing directly into the fields.
We have now defined 3 feature types within the Parks feature class. They are Community, Wilderness, and Sports. - Click Apply then OK to close the Feature Class Properties Dialog.
Now that we have defined Subtypes based on park types within the feature class, we would like to create Domains to restrict the values that users can enter within the ‘admission' field.
For example,
- Community Parks – Admission Free
- Sports Parks – Admission ranges from $5-$10 per visit
- Wilderness – Admission at $20 per visit
- With ArcCatalog still opened from the previous section, navigate to the Parks feature class in the Geodatabase.
- Right click on Parks to open the Feature Class Properties Dialog.
- Select the Subtypes tab to open the subtypes properties.
- We should have 3 subtypes defined for the feature class – Community, Wilderness and Sports.
- Click on the Domain button to open the Workspace Domain Dialog.
- Within the Workspace Domain Dialog, enter the 3 domains that we have defined by typing into the fields for Domain Name and provide a meaningful description within the Description field.
- Once we have defined the 3 different domains, we will now set the properties for each domain.
- Highlight the Community Domain by clicking on the corresponding field.
- Under the Domain Properties, set Field Type to ‘Long Integer' and Domain Type to ‘Coded Value' within the Domain Properties.
- Under the Coded Value section, create a new value of 0 with description. This restricts the allowable value for the admission field to 0.
- Highlight the Sports Domain, set Field Type to ‘Long Integer', Domain Type to ‘Range', Minimum Value to 5, and Maximum Value to 10. This restricts the allowable value for admission field to a value between 5 and 10.
- Highlight the Wilderness Domain, Set Field Type to ‘Long Integer' and Domain Type to ‘Coded Value' within the Domain Properties. Create a new item under the Coded Value section with value of 20. This restricts the allowable value for the admission field to 20.
- Click Apply then OK to close off the Workspace Domain Properties Dialog.
The following section will guide us in using the domain for each subtype. We would like to link the domain that we have defined in the previous section to the park type subtypes. Also, we would like to set Default values for the Community Park's admission to 0. When a Default value is defined, any new Community Park features created through Editing within ArcMap will automatically have 0 within their admission field.
Procedure
- In ArcCatalog, make sure the subtypes tab is opened within the Feature Class Properties dialog for the Parks feature class.
- Highlight the Community subtype under the Subtypes section.
- Click within the domain field beside ‘admission' within the Default Values and Domains section.
- A drop-down list will appear, allowing user to select the available list of domains. Select Community from the list.
- Enter ‘0' for the admission field under the Default Value column to define the default values for community park features.
- Repeat Steps 2 to 4 for both the Wilderness and the Sports subtypes and assigning Wilderness and Sports domain respectively.
- After defining the Domain, Click Apply then OK to close the Feature Class Properties Dialog
Now that we have prepared our data by using Subtypes/Domains, we will perform some editing on the Parks feature class. We will be adding 1 of each park type to the feature class and will look at how subtypes/domains can be used to create a more efficient editing workflow. We will also be assigning admission values to features that already exist within the feature class prior to editing new features.
Procedure
- Open ArcMap, start a New Map Document and add the Parks feature class into the Map Document.
- Right click on the Parks layer in the table of contents and select Open Attribute Table.
- Since the admission field was added recently, we will be assigning the admission values for existing features prior to creating new features.
- Right click on the Parks layer in the table of contents; go to Edit Features and Start Editing.
- Go back to the attribute table of the Parks layer, and click on the first record under the admission field.
- Since we have Domains defined, a drop-down menu will apply for coded value domain and user can select all the available choices for that field.
- Since a Range Domain was used for the Sports park feature, the value will have to be entered manually. Enter a value of ‘9' for Sports Park features. Ensure all admission fields are defined and close the attribute table.
- With Editing session still active from the previous step, Open the Create Features Window if necessary.
- The Create Features Window contains the 3 different features for the Parks layer. These features are created based on the 3 subtypes that we have defined previously.
- To create a new Community Park feature, click on Community in the Create Features Window and make sure Polygon is selected within the Construction Tool window.
- Start drawing a new polygon in the map window.
- Once finished sketching, ensure the newly created feature is selected and Open the Attributes window by clicking on the Attribute icon within the Editing Toolbar.
- Within the Attributes window, notice that the Community subtype is applied to the feature and the corresponding domain is also applied for the admission attribute. Since we have defined a Default Value in a previous section, any new Community Parks features created will automatically be assigned ‘Free Admission (0)' to the admission field.
- Repeat steps 10-13 to create a new Wilderness park feature. Instead of selecting Community in step 10, select Wilderness to create a Wilderness park feature.
- Repeat steps 10-12 to create another new Sports park feature.
- Within the Attributes window, notice that there is no drop-down menu within the admission field for the Sports park feature. This is because we have defined the domain as Range within the Domain Properties.
- Notice that the information in regards to the domain is also shown within the Attributes window. As defined by the domain, a value between 5 and 10 should be used. If a value outside of the range was entered, an error message will be shown upon validating the new feature through the option within the Editor menu. We will go ahead and enter a value of 20 to explore the feature validation in ArcMap.
- To Validate a feature, first ensure the newly created Sport feature is selected.
- Once the feature is selected, click on the Editor drop-down menu from the Editor toolbar and select Validate Features (as shown in the following image).
- Since we entered a value of 20 in the previous steps, an error message is displayed within ArcMap upon validating the feature. Click OK to close the error message.
- With the newly created Sport feature still selected, Open the Attribute Windows from the Editor Toolbar.
- Select the admission field and change the value to 7. Repeat the Validation process (Step18-19) to ensure the feature is now valid.
- Save your Edits and Close ArcMap
- Subtypes/Domains can be defined within a Geodatabase only.
- Subtypes can be defined based on a Short/Long integer attribute field to classify features into groups.
- Each subtype can have its own default value/domain.
- Domains allows user to restrict values to be used within a field with Coded or Range Values.
- Subtypes/Domains encourage a more efficient Editing workflow and reduce potential error when creating new features.
© 2013 Esri Canada. All Rights Reserved.
No comments:
Post a Comment