I have two shapefiles, one is polyline, one is points. I use points to split the polyline. How to record the FID of splited points(two end points each line) in the field of polyline.
First I use split tool
then I execute the following code to update the attribute table of polyline
import arcpy from arcpy import env env.overwriteOutput = True sj = r"in_memory\sj" inPoints=r"Y:\Desktop\road\city\city_merge1.shp" inPL = r"Y:\Desktop\road\highway.shp" arcpy.MakeFeatureLayer_management(inPoints, "city_points") arcpy.MakeFeatureLayer_management(inPL, "road") for i in range(0,500): expr = " [FID] =" + str(i) arcpy.SelectLayerByAttribute_management(inPL, "NEW_SELECTION", expr) arcpy.SpatialJoin_analysis(inPL, inPoints,sj,"JOIN_ONE_TO_ONE","KEEP_COMMON") ## update the attribute table of road, recording the FID of the city in the attribute table of the road