AnsweredAssumed Answered

Utilize fromWKT but add fields also

Question asked by navtechie on May 4, 2017

Beginner here so keep that in mind!


We have a data source that can provide me with SQL output in tab delimited form that contains fields + attributes, one of which being the vector info stored as an WKT string.

I am able to bring the vector info through into a new feature class easily enough with fromWKT but I also need to bring some of the fields + values along at the same time.

Code I have for bringing just the vectors.

 import arcpy
from arcpy import env

env.workspace = "C:/Student/clswkt"

inTable = "f94fd2128655d74d9788356402dc0434.csv"
arcpy,.TableToTable_conversion("inTable", "clswkt.gdb", "<feature class name>")

# Define field holding WKT coords

field1 = "shape_vector_new"

# Define field holding unique identifier (can be PVID or OBJECTID if you didn't include PVID

field2 = "OBJECTID"

# Redefine inTable to new table created

inTable = "clswkt.gdb/<tablename>"
featureList = []
cursor = arcpy.SearchCursor(inTable) 
row = 
while row: 
      WKT = row.getValue(field1) 
      temp = arcpy.FromWKT(WKT, "")
      row =

# Copy featurelist to a feature class
arcpy.CopyFeatures_management(featureList, "clswkt.gdb/<fcname>")


Thanks in advance.