arcpy.management.DeleteCodedValueFromDomain(in_workspace, domain_name, code)
|
Name
|
Erläuterung
|
Datentyp
|
|
in_workspace
|
Der Workspace, in dem sich die zu aktualisierende Domäne befindet.
|
Workspace
|
|
domain_name
|
Der Name der Domäne mit codierten Werten, die aktualisiert werden soll.
|
String
|
|
code
[code,...]
|
Die Werte, die aus der angegebenen Domäne gelöscht werden sollen.
|
String
|
Abgeleitete Ausgabe
|
Name
|
Erläuterung
|
Datentyp
|
|
out_workspace
|
Der aktualisierte Eingabe-Workspace.
|
Workspace
|
Codebeispiel
DeleteCodedValueFromDomain: Beispiel 1 (Python-Fenster)
Das folgende Skript für das Python-Fenster veranschaulicht, wie die Funktion DeleteCodedValueFromDomain im Direkt-Modus verwendet wird.
import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.DeleteCodedValueFromDomain("montgomery.gdb", "DistDiam", ["20","24"])
DeleteCodedValueFromDomain: Beispiel 2 (eigenständiges Skript)
In diesem eigenständigen Skript wird die Funktion DeleteCodedValueFromDomain als Teil eines Workflows verwendet, um eine Domäne zu bearbeiten.
# Name: RemoveDomainsExample.py
# Purpose: Update an attribute domain to constrain valid pipe material values
# Import system modules
import arcpy
import os
# Set the workspace (to avoid having to type in the full path to the data every time)
arcpy.env.workspace = "data"
# Set local parameters
inFeatures = "Montgomery.gdb/Water/DistribMains"
inField = "MATERIAL"
dWorkspace = "Montgomery.gdb"
domName = "Material"
codedValue = "ACP: Asbestos concrete"
codeField = "TYPE"
descField = "DESRIPT"
# Process: Remove the constraint from the material field
arcpy.management.RemoveDomainFromField(inFeatures, inField)
# Edit the domain values
# Process: Remove a coded value from the domain
arcpy.management.DeleteCodedValueFromDomain(dWorkspace, domName, codedValue)
# Process: Create a table from the domain to edit it with ArcGIS Pro editing tools
arcpy.management.DomainToTable(dWorkspace, domname,
os.path.join(dWorkspace, domname), codeField,
descField)
# Process: Delete the domain
arcpy.management.DeleteDomain(dWorkspace, domName)
# Edit the domain table outside of geoprocessing
# and then bring the domain back in with the TableToDomain process