POST
|
That was what worked for me Randy. Working code below. Thanks for the help. import arcpy
arcpy.env.workspace = r"F:\ITree\ITree.gdb"
gdb = arcpy.env.workspace
arcpy.env.overwriteOutput = True
domains = arcpy.da.ListDomains(gdb)
for domain in domains:
if domain.domainType == 'CodedValue':
domain_name = domain.name
print 'Exporting {0} coded values to table in {1}'.format(domain_name, gdb)
coded_value_list = domain.codedValues
print "The coded values / descriptions are"
for value, descrip in coded_value_list.iteritems():
print "{0} : {1}".format(value, descrip)
out_table_name = domain_name.lower()
arcpy.DomainToTable_management(gdb, domain_name, out_table_name, "item", "descrip")
else:
print "{0} not a coded value domain. Passing it up.".format(domain.name) I changed the env.workspace to the full path and set that to the gdb variable
... View more
08-14-2015
10:37 PM
|
2
|
0
|
2438
|
POST
|
I've attempted to write a script that will export all the coded value domains in a geodatabase to a table. Before I dig in the to script and what's wrong, I have looked at the similar question on this topic, but that script would not run for me. Here is my code: import arcpy arcpy.env.workspace = r"F:\ITree" gdb = r"ITree.gdb" arcpy.env.overwriteOutput = True domains = arcpy.da.ListDomains(gdb) for domain in domains: if domain.domainType == 'CodedValue': domain_name = domain.name print 'Exporting {0} coded values to table in {1}'.format(domain_name, gdb) coded_value_list = domain.codedValues print "The coded values / descriptions are" for value, descrip in coded_value_list.iteritems(): print "{0} : {1}".format(value, descrip) out_table_name = domain_name.lower() arcpy.DomainToTable_management(gdb, domain_name, out_table_name, "item", "descrip") else: print "{0} not a coded value domain. Passing it up.".format(domain.name) When I comment out the Domain to Table, the script runs and produces, this: Exporting LANDUSE coded values to table in ITree.gdb The coded values / descriptions are 1 : Single family residential 0 : Not entered 3 : Small commercial 2 : Multi-family residential 5 : Park/vacant/other 4 : Industrial/Large commercial However, when I uncomment the Domain to Table, it produces the following error: Exporting LANDUSE coded values to table in ITree.gdb The coded values / descriptions are 1 : Single family residential 0 : Not entered 3 : Small commercial 2 : Multi-family residential 5 : Park/vacant/other 4 : Industrial/Large commercial Traceback (most recent call last): File "E:/Work/MDC/GISData/MOTools/Scripts/export_gdb_domains.py", line 29, in <module> arcpy.DomainToTable_management(gdb, domain_name, out_table_name, "item", "descrip") File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 1491, in DomainToTable raise e arcgisscripting.ExecuteError: ERROR 999999: Error executing function. Failed to execute (DomainToTable). It also produces the first table from the domain, but does not copy the coded values and creates an empty table. I've looked through the help documents for Domain to Table (Data Management) and List Domains, but I cannot figure out why it's throwing an error. Clearly something is off in the Domain to Table function, but I can't figure out what, especially since it prints all the parameters correctly. I would greatly appreciate any suggestions. Thank you for your time.
... View more
08-14-2015
04:27 PM
|
0
|
5
|
9088
|
POST
|
Hello, I'm trying to import a shapefile onto a Garmin GPSmap 62st using DNR Garmin 5.04. The problem i'm having is that the GPS will not display all the attributes at once. It seperates them into seperate tracks and will only display them one at a time. Is there anyway to fix this on either ArcMap or on the GPS? Thanks
... View more
01-24-2012
08:33 AM
|
0
|
0
|
2549
|
Title | Kudos | Posted |
---|---|---|
2 | 08-14-2015 10:37 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|