Podrías probar algo como esto:
para el escenario mostrado arriba, el siguiente guion
import arcpy
roads1 = #path to roads layer 1
roads2 = #path to roads layer 2
r1 = [row for row in arcpy.da.SearchCursor(roads1,["SHAPE@","NAME"])]
#add field to hold required string
arcpy.AddField_management(roads2,"COMMENTS","TEXT")
with arcpy.da.UpdateCursor(roads2,["SHAPE@","NAME","COMMENTS"]) as cursor:
for r in r1:
for row in cursor:
if r[0].contains(row[0]):
print "{0} contains {1}".format(r[1],row[1])
#start = arcpy.PointGeometry(row[0].firstPoint)
#end = arcpy.PointGeometry(row[0].lastPoint)
#road segments connected to the road segment from layer 1 that "contains"
# a segment from layer 2
connected_segments = [x for x in r1 if x[0].touches(r[0])]
#find closest road segments
#closest_seg_to_start = [[y[1],y[0].queryPointAndDistance(start)[2]] for y in connected_segments if len(connected_segments)]
#closest_seg_to_end = [[y[1],y[0].queryPointAndDistance(end)[2]] for y in connected_segments if len(connected_segments)]
closest_seg_to_start = [[y[1],y[0].distanceTo(row[0].firstPoint)] for y in connected_segments if len(connected_segments)]
closest_seg_to_end = [[y[1],y[0].distanceTo(row[0].lastPoint)] for y in connected_segments if len(connected_segments)]
if len(closest_seg_to_start):
start_min_dist = min([x[1] for x in closest_seg_to_start])
start_seg_name = [x[0] for x in closest_seg_to_start if x[1]== start_min_dist][0]
print "{0} is {1}km from start point of {2}".format(start_seg_name,round(start_min_dist/1000.0,2),row[1])
if len(closest_seg_to_end):
end_min_dist = min([x[1] for x in closest_seg_to_end])
end_seg_name = [x[0] for x in closest_seg_to_end if x[1]== end_min_dist][0]
print "{0} is {1}km from end point of {2}".format(end_seg_name,round(end_min_dist/1000.0,2),row[1])
comment = "{0},{1}km from {2} to {3}km from {4}".format(r[1],round(start_min_dist/1000.0,2),start_seg_name,round(end_min_dist/1000.0,2),end_seg_name)
print comment
row[2] = comment #add string to field
cursor.updateRow(row)
produce estos resultados: