如果域被要素类占用,那么不能直接删除域,需要解除字段和域的关联,才能删除域。解除关联可以使用GP工具Remove Domain From Field,工具在Toolboxes\System Toolboxes\Data Management Tools.tbx\Domains。
如果有很多要素类,并且不知道哪些字段使用了域,可以使用Python来检查一下。检查后,再使用Remove Domain From Field解除关联,然后删除域。
import arcpy
#Set workspace environment to geodatabase
arcpy.env.workspace = your_gdb
#Get list of feature classes in geodatabase
FCs = arcpy.ListFeatureClasses()
#Loop through feature classes in list
for FC in FCs:
#List fields in feature class
fields = arcpy.ListFields(FC)
#Loop through fields
for field in fields:
#Check if field has domain
if field.domain != '':
#Print feature class, field, domain name
print FC, field.name, field.domain
标签:domain,删除,fields,feature,field,FC,ArcMap,arcpy,属性 From: https://blog.51cto.com/u_15483489/5721109