Hi,
I have a CSV storing addresses, reference numbers, etc... and also a WKT string of boundary coordinates for each property:
The script (ammended from another user's post in 2012) sccessfully converts the CSV to a shapefile, with the spatial refeence set to EPSG- 27700:
import arcpy
File = "C:\\Users\\Team\\Documents\\Theo Laptop Folder\\Tasks\\Quick tasks\\WKTtest\\WKT_to_QGISmakealayerCSV2.csv"
field1 = "WKT"
field2 = "Our_ref"
featureList = []
sr = arcpy.SpatialReference(27700)
cursor = arcpy.SearchCursor(File)
row = cursor.next()
while row:
print (row.getValue(field2))
WKT = row.getValue(field1)
temp = arcpy.FromWKT(WKT, sr)
featureList.append(temp)
row = cursor.next()
arcpy.CopyFeatures_management(featureList, "C:\\Users\\Team\\Documents\\Theo Laptop Folder\\Tasks\\Quick tasks\\WKTtest\\WKTShapes.shp")
del row, temp, WKT, File, field1, featureList, cursor
This is in python 2.7 language fyi. (I'd love this in 3.6 if possible...)
Now when I drag the newly created shapefile into Arc it all looks great, but the fields from the CSV aren't carried across...
How can I ammend the code to include all the original string fields from the CSV?
thank you