Hi,
I have a csv file with different fields:
Address,route
First Av,[(39.72412, -104.9995), (39.72412, -105.00091), (39.72417, -105.00157), (39.72422, -105.00159)]
Second Av,[(39.72412, -104.9995), (39.72412, -105.00091), (39.72417, -105.00157), (39.72422, -105.00159)]
Street Av,[(39.72412, -104.9995), (39.72412, -105.00091), (39.72417, -105.00157), (39.72422, -105.00159)]
Street Av,[(39.72412, -104.9995), (39.72412, -105.00091), (39.72417, -105.00157), (39.72422, -105.00159)]
Whith this code i create a polyline use the array coordinate field by csv:
import arcpy,csv,ast
csvfile =r'lyft_1.csv'
folder=r'C:\Temp'
shapename=r'PolylineCSV.shp'
spatref_epsg=3006
icur=arcpy.da.InsertCursor(os.path.join(folder,shapename),'SHAPE@')
with open(csvfile,'rb') as f:
reader = csv.DictReader(f)
for row in reader:
listrow=ast.literal_eval(row["route"])
line=arcpy.Polyline(arcpy.Array([arcpy.Point(*coords) for coords in listrow]))
icur.insertRow((line,))
del icur
But how i can insert the field address with array coordinate into Polyline?