Alter Domain (Data Management)

Summary

Alters the properties of an existing attribute domain in a workspace.

Usage

  • Domain management involves the following steps:

    1. Modify an existing domain using this tool, or create a new domain using the Create Domain tool.
    2. Add values to or set the range of values for the domain using the Add Coded Value to Domain tool or Set Value For Range Domain tool.
    3. Associate the domain with a feature class using the Assign Domain To Field tool.
  • Coded value domains only support default value, duplicate split policy, and default value merge policy.

  • Range domains support all split and merge policies. After a split or merge operation, the attribute values of output features are calculated based on the numeric values of the input features and the specified split or merge policy.

Syntax

AlterDomain(in_workspace, domain_name, {new_domain_name}, {new_domain_description}, {split_policy}, {merge_policy})
ParameterExplanationData Type
in_workspace

The geodatabase that contains the domain to be altered.

Workspace
domain_name

The name of the domain to be altered.

String
new_domain_name
(Optional)

The new name of the domain.

String
new_domain_description
(Optional)

The new description of the domain.

String
split_policy
(Optional)

The split policy of the domain. The behavior of an attribute's values when a feature that is split is controlled by its split policy.

  • DEFAULTThe attributes of the two resulting features take on the default value of the attribute of the given feature class or subtype.
  • DUPLICATEThe attribute of the two resulting features takes on a copy of the original object's attribute value.
  • GEOMETRY_RATIOThe attributes of resulting features are a ratio of the original feature's value. The ratio is based on the proportion into which the original geometry is divided. If the geometry is divided equally, each new feature's attribute gets one-half the value of the original object's attribute. The geometry ratio policy only applies to range domains.
String
merge_policy
(Optional)

The merge policy of the domain. When two features are merged into a single feature, merge policies control attribute values in the new feature. Altering this property applies only to range domains, as coded value domains may only use the default merge policy.

  • DEFAULTThe attribute of the resulting feature takes on the default value of the attribute of the given feature class or subtype. This is the only merge policy that applies to nonnumeric fields and coded value domains.
  • SUM_VALUESThe attribute of the resulting feature takes on the sum of the values from the original feature's attribute. The sum values policy only applies to range domains.
  • AREA_WEIGHTEDThe attribute of the resulting feature is the weighted average of the attribute values of the original features. This average is based on the original feature's geometry. The area weighted policy only applies to range domains.
String

Derived Output

NameExplanationData Type
out_workspace

The updated input workspace.

Workspace

Code sample

AlterDomain example 1 (Python window)

The following code snippet demonstrates how to use AlterDomain in the Python window.

arcpy.env.workspace = "C:/data"
arcpy.AlterDomain_management("montgomery.gdb", "Material", "PipeMaterial", "Valid pipe materials", "DUPLICATE", "DEFAULT")
AlterDomain example 2 (stand-alone script)

The following code snippet demonstrates how to use AlterDomain in a stand-alone script.

# Name: AlterDomain.py
# Description: Modify an attribute domain to constrain valid date
#              range for wildlife sightings.
# Author: ESRI
 
# Import system modules
import arcpy
from arcpy import env
 
# Set the workspace
env.workspace = "C:/data"
 
# Set local parameters
gdb = "Habitat.gdb"
domName = "CoastalArea"
new_domName = "SightingSeason"
new_desc = "Range of valid dates for sightings"
new_split = "DUPLICATE"
new_merge = "AREA_WEIGHTED"

# Process: Modify the range domain
arcpy.AlterDomain_management(gdb, domName, new_domName, new_desc, new_split, new_merge)

Environments

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics