Friday 24 July 2015

arcmap - Split Polyline at Set Intervals


I have a polyline layer that has been joined to a table and I need to split it at certain distances along the line.


The attribute table contains the distances at which I would like to split the lines. The attribute table looks like this:Attribute Table



I need to split the line a two spots, ChStaL and ChStaR, which are both distances from the starting node.


I'd really like a python type solution if possible as I have over 30 of these layers.


I've been cruising around ESRI help docs and ArcToolbox but, haven't found anything that will allow me to do this en-mass. Almost everything out there requires me to do manually editing.


Any help would be most appreciated.



Answer



In 10.1 you could use the new positionAlongLine function to generate the points you want to split by, and then use the Split Line at Point tool.


I don't have 10.1 installed to test with but you would basically do the following:



  1. Create a new empty point feature class

  2. Open a SearchCursor on your line feature class


  3. Open an InsertCursor on your point feature class

  4. For each line:

    1. Get a point using positionAlongLine with your first distance attribute (ChStaL)

    2. Get a point using positionAlongLine with your second distance attribute (ChStaR)

    3. Insert the two points into the point feature class



  5. Delete the cursor objects

  6. Use Split Line At Point to create a new line feature class with lines in the original line feature class split by the points in the now-populated point feature class.



Alternatively use linear referencing as mentioned in @Horbydd's answer.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...