-
Notifications
You must be signed in to change notification settings - Fork 2
/
DecodeCodedDomains.py
43 lines (32 loc) · 1.79 KB
/
DecodeCodedDomains.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def main():
import arcpy, os
#~~~~~
#get parameters from dialog box
gdb = arcpy.GetParameterAsText(0)
#~~~~~
# global variables
arcpy.env.workspace = gdb
#gdb = r"P:\Map_Data_Model\MAPS\Pierce-StCroix_Bedrock\Pierce-StCroix_Working_V1.gdb"
arcpy.env.overwriteOutput = True
for dom in arcpy.da.ListDomains(arcpy.env.workspace):
if dom.domainType == 'CodedValue':
arcpy.DomainToTable_management(in_workspace=arcpy.env.workspace,
domain_name=dom.name,
out_table=os.path.join(arcpy.env.workspace, dom.name),
code_field=dom.name + "Code",
description_field= dom.name + "Description",
configuration_keyword="")
print " - domain '{0}' of type '{1}' exported to table".format(dom.name, dom.domainType)
elif dom.domainType == 'Range':
arcpy.DomainToTable_management(in_workspace=arcpy.env.workspace,
domain_name=dom.name,
out_table=os.path.join(arcpy.env.workspace, dom.name),
code_field=dom.name + "Code",
description_field= dom.name + "Description",
configuration_keyword="")
print('Min: {0}'.format(dom.range[0]))
print('Max: {0}'.format(dom.range[1]))
else:
print " - domain '{0}' of type '{1}' skipped".format(dom.name, dom.domainType)
if __name__ == '__main__':
main()