Skip to main content
added 111 characters in body
Source Link
MAR
  • 183
  • 1
  • 7

I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.

Any ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain''domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain''domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain']row['domain'], row['code'],  row['code_description'])

print("Done")

And here's my CSV File:

[![enter code here][1]][1]

I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.

Any ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain'], row['code'],  row['code_description'])

print("Done")

I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.

Any ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['domain'], row['code'],  row['code_description'])

print("Done")

And here's my CSV File:

[![enter code here][1]][1]
naming
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

Create ArcGIS geodatabase domains from a csvCSV file using Python

I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.

Any Ideasideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain'], row['code'],  row['code_description'])

print("Done")

Create ArcGIS geodatabase domains from a csv file using Python

I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.

Any Ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain'], row['code'],  row['code_description'])

print("Done")

Create ArcGIS geodatabase domains from a CSV file using Python

I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.

Any ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain'], row['code'],  row['code_description'])

print("Done")
naming
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

Create arcgis GeodatabaseArcGIS geodatabase domains from a csv file using pythonPython

I want to create arcgisArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my csvCSV file.

Any Ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain'], row['code'],  row['code_description'])

print("Done")

Create arcgis Geodatabase domains from a csv file using python

I want to create arcgis geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my csv file.

Any Ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain'], row['code'],  row['code_description'])

print("Done")

Create ArcGIS geodatabase domains from a csv file using Python

I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.

Any Ideas ?

Here's the code I am using :

import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb                 = "NEW.sde"
csvfile             = "D:/DATA/Domains.csv"
domains = []
rows = []

with open(csvfile, 'r') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        try:
           domains.append(row.get('Domain'))
           rows.append(row)
        except KeyError:
           rows = [row]

 domains = list(set(domains))
 print("Identified %s unique domains" % len(domains))
 print("Identified %s codes" % len(rows))


 print("Creating codes:")
 for row in rows:
     print("%s\t%s\t%s" % (row.get('Domain'), row.get('code'), row.get('code_description')))
     arcpy.AddCodedValueToDomain_management(gdb, row['Domain'], row['code'],  row['code_description'])

print("Done")
Source Link
MAR
  • 183
  • 1
  • 7
Loading