# Splitting lines automatically at specific distances?

I have a set of polylines I need to split at varying distances from their starting points. In general I'm looking for a something similar to the SPLIT function within the editor tool. There it is possible to specify a certain line length where the split should be applied. For instance: I have a line A of 3200m length, that I need to split into two separate geometries, one from 0 til 1700m, and one from 1700m til 3200m.

Does anyone have accomplished this using python? Or this there no way around ArcObjects? Or might there be a different solution I'm missing?

I'm using ArcGis 9.3.1. on WinXP with python 2.7.2.5.

-

I've used this ArcObjects class to split line features before at specific distances.

http://edndoc.esri.com/arcobjects/8.3/Samples/Editing/Edit%20Commands/Line%20Edit%20Toolbar/clsDivideLineFeatures.htm

-
This is a very interesting add-on! Thanks for sharing the information. Do you have ever used it from within a script? I need to apply splits at varying distances to more than 100 lines. So what I need here is to call the "Proportion"-tool with an array of distances. Is that possible? Thanks mate! –  LarsVegas May 14 '12 at 12:11
Since you are using 9.3.1, you could either create a VBA macro or a Visual Studio BaseCommand dll. edndoc.esri.com/arcobjects/9.2/NET/…. Then you could iterate through your layer, selecting each feature, and spliting the feature maybe by the feature field value (split at distance value). –  artwork21 May 14 '12 at 12:55
Thanks, I'll look into it. Sounds like a lot of work though, especially because this is terra incognita for me. Might be easier to find someone with ArcGIS 10 installed and let him/her run the `SplitLineAtPoint_management`-tool. –  LarsVegas May 14 '12 at 14:58

you can use two Data Management method with arcpy:

First of all is Split Line At Point (info):

``````import arcpy
from arcpy import env

env.workspace="C:/data"
arcpy.SplitLineAtPoint_management("streets.shp","events.shp","splitline_out.shp","20 Meters")
``````

Second is Split Line At Vertices (info):

``````import arcpy
from arcpy import env
env.workspace = "C:/data"
``````

i hope it helps you...

-
The line at point tool is what I'm looking for. Unfortunately it doesn't exist with ArcGis 9.3.1 yet. The line at vertices tool doesn't help much because I end up with thousandths of splits I don"t need. –  LarsVegas May 14 '12 at 9:47