Hi :)
I'm currently trying to insert polygons into a feature class given a list of (ID, X coordinate, Y coordinate) from Oracle
So far I do:
Do I have a way to insert them faster without looping on the data? (using some kind of array / arcpy function / csv file insert)
thanks :)
I'm currently trying to insert polygons into a feature class given a list of (ID, X coordinate, Y coordinate) from Oracle
So far I do:
Code:
pntsLayer = arcpy.InsertCursor(myTableLnk)
def save(cursor, list, seq):
if seq is None or len(list) == 0:
return
pfeat = cursor.newRow()
array = arcpy.Array(list)
poly = arcpy.Polygon(array, oracle_sr)
pfeat.SHAPE = poly
pfeat.POLY_ID = seq
cursor.insertRow(pfeat)
list = []
prev_seq = None
for (seq, long, lat) in data:
pnt = arcpy.Point() # moved out before the loop?
pnt.X = long
pnt.Y = lat
if prev_seq != seq:
save(pntsLayer , list, prev_seq)
prev_seq = seq
list = []
list.append(pnt)
Do I have a way to insert them faster without looping on the data? (using some kind of array / arcpy function / csv file insert)
thanks :)