Using code I found on Creating point at midpoint of polyline with ArcPy?, I've gotten my code to generate midpoints due to the 0.50 parameter in the position along line tool (below). BUT. I don't want to generate a specific percentage every time. I want to call the percentage in "duration_fraction" associated with each polyline (below), and put it in as the percentage in the points. So Polyline 1 would generate a point 86% of the way along the line. How should I go about this? Can I use a search cursor within a search cursor?
in_data = "L:\\gathr\\indonesia\\Sara\\Lines_withinTimes\\Day_andmmsi\\s20160101fc_lines.gdb\\Detection1_lines_UTM"
detectpoint = "L:\\gathr\\indonesia\\Sara\\Lines_withinTimes\\Day_andmmsi\\s20160101fc_lines.gdb\\MEOWWW"
polyline = "L:\\gathr\\indonesia\\Sara\\Lines_withinTimes\\Day_andmmsi\\s20160101fc_lines.gdb\\Detection1_lines_UTM"
#housekeeping
arcpy.DeleteFeatures_management(detectpoint)
arcpy.env.overwriteOutput = True
#generating the mid point
with arcpy.da.SearchCursor(polyline, "SHAPE@") as in_cursor, \
arcpy.da.InsertCursor(detectpoint, "SHAPE@") as out_cursor:
for row in in_cursor:
fraction = row.getValue("duration_fraction")
midpoint = row[0].positionAlongLine(0.50,True).firstPoint
out_cursor.insertRow([midpoint])