More

Split a shapefile of lines into even spaced segments


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.


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

Or

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

import arcpy arcpy.env.overwriteOutput = 1 in_fc = r'C:UsersUSER_NAMEDocumentsArcGIScenterline1.shp' out_fc = r'C:UsersUSER_NAMEDocumentsArcGISsplit_eq.shp' out_count = 10 # how many features desired feat = [] for i in arcpy.da.SearchCursor(in_fc, ("[email protected]",)): 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.


Watch the video: How to download Shapefile Data GIS for any country (October 2021).