AnsweredAssumed Answered

How to create line segments and add sequential ids

Question asked by wendyhelen on Nov 20, 2016
Latest reply on Nov 21, 2016 by rastrauch

I’m fairly inexperienced with python, but have been attempting to use it to automate a geoprocessing workflow. I’ve pieced together most of it, but I’m stuck with one section…


I have a shapefile with transect lines, and attribute fields TransNa (transect name) and surveydate (date of survey). I want to split each transect line into segments based on a user specified distance. The output file would have a number of segments representing each transect line. I also want to add a few fields to the output file.


Interval – sequential record number for each segment of a transect line.  First segment of each transect line would be 1.


Segment – Sort records by surveydate, TransNa and Interval fields, then add a sequential record number for all records.


Mid_x – x  coordinate for segment midpoint


Mid_y – y coordinate for segment midpoint


Any guidance on how to achieve this would be much appreciated!