I am collecting start and end points for a large polyline feature class in a file geodatabase. I am using arcpy, ArcGIS 10.3, Python 2.7.3 64-bit and a 10.3 compressed file geodatabase with just one feature class (and no other objects).
One accesses the geometry properties with the SHAPE@ token which gives access to the geometry of the line (namely firstPoint and lastPoint).
with arcpy.da.SearchCursor(fc, ["OID@", "SHAPE@"],query) as search_cur:
allLinesList = [[row[0],(row[1].firstPoint.X,row[1].firstPoint.Y),
(row[1].lastPoint.X,row[1].lastPoint.Y)]
for row in search_cur]
Reading 1 million line features (note that my lines consist of only two vertices, start and end) takes ca 5 minutes. I have tried using for loop iterating a cursor instead of comprehension and iterating features in chunks of several hundred thousands with no significant difference in time.
Do you know any other faster way to read XY of the start and end points of the lines?