Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Data Management toolbox > Domains toolset > Tools

Create Domain (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

Creates an attribute domain in the specified workspace.


Usage tips

Command line syntax
An overview of the Command Line window
CreateDomain_management <in_workspace> <domain_name> <domain_description> <SHORT | LONG | FLOAT | DOUBLE | TEXT | DATE> {CODED | RANGE} {DEFAULT | DUPLICATE | GEOMETRY_RATIO} {DEFAULT | SUM_VALUES | AREA_WEIGHTED}

Parameter Explanation Data Type
<in_workspace>

The geodatabase that will contain the new domain.

Workspace
<domain_name>

The name of the domain that will be created.

String
<domain_description>

The description of the domain that will be created.

String
<SHORT | LONG | FLOAT | DOUBLE | TEXT | DATE>

The type of attribute domain to create. Attribute domains are rules that describe the legal values of a field type. Specify a field type that matches the data type of the field to which the attribute domain will be assigned.

  • SHORT — Numeric values without fractional values within a specific range; coded values.
  • LONG — Numeric values without fractional values within a specific range.
  • FLOAT — Numeric values with fractional values within a specific range.
  • DOUBLE — Numeric values with fractional values within a specific range.
  • TEXT — Names or other textual qualities.
  • DATE — Date and/or time.

String
{CODED | RANGE}

The domain type to create:

  • CODED — Specifies a valid set of values for an attribute. For example, a coded value domain might specify valid|material values: CL - cast iron pipe, DL - ductile iron pipe, or ACP - asbestos concrete pipe.
  • RANGE — Specifies a valid range of values for a numeric attribute. For example, if distribution water mains have a pressure between 50 and 75 psi, then a range domain would specify these minimum and maximum values.

String
{DEFAULT | DUPLICATE | GEOMETRY_RATIO}

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

  • DEFAULT — The attributes of the two resulting features take on the default value of the attribute of the given feature class or subtype.
  • DUPLICATE — The attribute of the two resulting features takes on a copy of the original object's attribute value.
  • GEOMETRY_RATIO — The 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
{DEFAULT | SUM_VALUES | AREA_WEIGHTED}

The merge policy of the created domain. When two features are merged into a single feature, merge policies control attribute values in the new feature.

  • DEFAULT — The 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 non-numeric fields and coded value domains.
  • SUM_VALUES — The 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_WEIGHTED — The 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
Data types for geoprocessing tool parameters


Command line example

workspace E:\arcgis\ArcTutor\BuildingaGeodatabase
CreateDomain montgomery.mdb DistDiam "Valid diameter for distribution mains" FLOAT CODED

Scripting syntax
About getting started with writing geoprocessing scripts
CreateDomain_management (in_workspace, domain_name, domain_description, field_type, domain_type, split_policy, merge_policy)

Parameter Explanation Data Type
in_workspace (Required)

The geodatabase that will contain the new domain.

Workspace
domain_name (Required)

The name of the domain that will be created.

String
domain_description (Required)

The description of the domain that will be created.

String
field_type (Required)

The type of attribute domain to create. Attribute domains are rules that describe the legal values of a field type. Specify a field type that matches the data type of the field to which the attribute domain will be assigned.

  • SHORT — Numeric values without fractional values within a specific range; coded values.
  • LONG — Numeric values without fractional values within a specific range.
  • FLOAT — Numeric values with fractional values within a specific range.
  • DOUBLE — Numeric values with fractional values within a specific range.
  • TEXT — Names or other textual qualities.
  • DATE — Date and/or time.

String
domain_type (Optional)

The domain type to create:

  • CODED — Specifies a valid set of values for an attribute. For example, a coded value domain might specify valid|material values: CL - cast iron pipe, DL - ductile iron pipe, or ACP - asbestos concrete pipe.
  • RANGE — Specifies a valid range of values for a numeric attribute. For example, if distribution water mains have a pressure between 50 and 75 psi, then a range domain would specify these minimum and maximum values.

String
split_policy (Optional)

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

  • DEFAULT — The attributes of the two resulting features take on the default value of the attribute of the given feature class or subtype.
  • DUPLICATE — The attribute of the two resulting features takes on a copy of the original object's attribute value.
  • GEOMETRY_RATIO — The 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 created domain. When two features are merged into a single feature, merge policies control attribute values in the new feature.

  • DEFAULT — The 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 non-numeric fields and coded value domains.
  • SUM_VALUES — The 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_WEIGHTED — The 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

Data types for geoprocessing tool parameters


Script example

# Purpose: Create an attribute domain to constrain|material values

# Create the Geoprocessor object
import arcgisscripting
gp = arcgisscripting.create()

try:
    # Set the workspace (to avoid having to type in the full path to the data every time)
    gp.Workspace = "E:/arcgis/ArcTutor/BuildingaGeodatabase"

    # Set variable for domain name
    domname = "Material4"

    # Process: Create the coded value domain
    gp.CreateDomain("montgomery.mdb", domname, "Valid|materials", "TEXT", "CODED")

    # Process: Add valid material types to the domain 
    gp.AddCodedValueToDomain("montgomery.mdb", domname, "CI", "Cast iron")
    gp.AddCodedValueToDomain("montgomery.mdb", domname, "DI", "Ductile iron")
    gp.AddCodedValueToDomain("montgomery.mdb", domname, "PVC", "PVC")
    gp.AddCodedValueToDomain("montgomery.mdb", domname, "ACP", "Asbestos concrete")
    gp.AddCodedValueToDomain("montgomery.mdb", domname, "COP", "Copper")

    # Process: Constrain the material value of distribution mains
    gp.AssignDomainToField("Montgomery.mdb/Water/Distribmains", "Material", domname)

except:
    # If an error occurred while running a tool print the messages
    print gp.GetMessages()

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.