0

I am using ArcGIS ArcMap 10.2.

I have a shapeless of polylines and want to split them each line into 100 m segments. I can see under the editor toolbar the split tool and that can divide each line into equal parts and accepts an input distance.

My issue is that my shapefile contains 1000's of polyline, (road map of a state). Is there a way I can do each line of my shapefile in one go? I can't merge the roads together as I still require the associated attributes.

1
  • If you are open to using QGIS, there is a tool that can do this: Processing Toolbox -> GRASS -> v.to.points. Commented Aug 27, 2015 at 8:47

1 Answer 1

3

I would use ET GEOWOZARD. You can split by equal parts in this tool. This tool tracks attributes too.

demo

Or

If you need just splitting by equal size the try the following code.

import arcpy
arcpy.env.overwriteOutput = 1


in_fc = r'C:\Users\USER_NAME\Documents\ArcGIS\centerline1.shp'
out_fc = r'C:\Users\USER_NAME\Documents\ArcGIS\split_eq.shp'
out_count = 10 # how many features desired
feat = []
for i in arcpy.da.SearchCursor(in_fc, ("SHAPE@",)):
    global feat
    feat.append([i[0].segmentAlongLine(j/float(out_count), ((j+1)/float(out_count)), True) for j in range(0, out_count)])


arcpy.CopyFeatures_management([item for sublist in feat for item in sublist],out_fc)

And try spatial join to get back attributes of split lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.