arcpy.management.DeleteCodedValueFromDomain(in_workspace, domain_name, code)
|
Nom
|
Explication
|
Type de données
|
|
in_workspace
|
Espace de travail contenant le domaine à mettre à jour.
|
Workspace
|
|
domain_name
|
Nom du domaine de valeurs précodées à mettre à jour.
|
String
|
|
code
[code,...]
|
Valeurs à supprimer du domaine spécifié.
|
String
|
Sortie dérivée
|
Nom
|
Explication
|
Type de données
|
|
out_workspace
|
Espace de travail en entrée mis à jour.
|
Workspace
|
Exemple de code
Exemple 1 d’utilisation de la fonction DeleteCodedValueFromDomain (fenêtre Python)
Le script de fenêtre Python ci-dessous illustre l’utilisation de la fonction DeleteCodedValueFromDomain en mode immédiat.
import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.DeleteCodedValueFromDomain("montgomery.gdb", "DistDiam", ["20","24"])
Exemple 2 d’utilisation de la fonction DeleteCodedValueFromDomain (script autonome)
Ce script autonome utilise la fonction DeleteCodedValueFromDomain dans le cadre d’un processus destiné à mettre à jour un domaine.
# 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