Select to view content in your preferred language

Editor function "split by distance" also usable with Python?

1283
10
11-25-2010 10:19 PM
SeldaSamiri
Emerging Contributor
Hi there,

I need to split a line feature at specific distances from the starting vertex. I can do this manually with the editor (fuction "split -> distance"). Is there a possibility to use this functionality also in Python?
If not - any ideas how to program it?

Thanks for help!
Selda
0 Kudos
10 Replies
NiklasNorrthon
Frequent Contributor
ArcToolbox tool Densify maybe? Requires ArcEditor license. Might be a new tool in ArcGIS 10.
0 Kudos
SeldaSamiri
Emerging Contributor
Hi Niklas,
this tool was a promising suggestion (I didn't know it, yet). But I tried to use it (directly from the toolbox), but nothing happens?! I used a polyline feature (no curves) and the distance I used was definitly smaller than the line lengths, but the output remained the same like the input.

What's wrong??

Thanks ideas!
Selda
0 Kudos
StefanHaglund1
Esri Contributor
Selda, I believe the Densify tool doesn't create new output but changes your input layer. Did you try starting an editsession and viewing the vertices of the data?
0 Kudos
ChrisMathers
Deactivated User
This sounds like a job for geometry objects.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Geometry/000v00000095000000/

I cant help much beyond that as I am just learning how to use these as well.
0 Kudos
SeldaSamiri
Emerging Contributor
Hi Nooski,

Thanks!! Yes, they're there! I expected that the tool would split the features at the new vertices, so I wondered why the attribute table remained the same.

So now I try to go on...

Thanks again,
Selda
0 Kudos
SeldaSamiri
Emerging Contributor
Hi Chris,

thanks for your reply, but as I understand, with geometry I can only read out the length of my features but can't change it.

I think I have to go a more complex way like inserting first a new vertex at my wished distance with the densify tool, then split the whole polyline at the vertices, and then "walk" the segments one by one, summarize the lengths and copy each segment as long as the length is below my wished length. In the end I can unsplit all the copied features and have the polyline I wished.

That's the way I will try out now, I hope it works out 🙂

Thanks again,
Selda
0 Kudos
ChrisMathers
Deactivated User
Well you can try reading the geometry of the line to get the coords of the vertexs and use those to find the angle of the line. Then a point object can be created along that line wherever you would like and use that as an input for arcpy.SplitLineAtPoint_management().
0 Kudos
SeldaSamiri
Emerging Contributor
Hi Chris,
sorry, I didn't get your suggestion.
What I have is a stream as polyline and a sampling site as point. I split the stream at the sampling site. Then I want to extract the segment of the stream 1500 m upstream of this sampling site.
So the stream has many vertices in 1500 m length as it is curving. What I have to find is the segment of the stream that exceeds the 1500m limit. And yes, then I can calculate the right point between the two nodes of this segment for example with the theorem on intersecting lines, or with the angle (don't know, how this would work, yet). But for this I have to "walk" on each segment like I described before, until I come to the 1500m. Or is there an easier solution?

Sinje
0 Kudos
AaronHigh
Deactivated User
If you haven't resolved this yet, I had to come up with a workaround to a similar issue recently. You may try a two step approach as follows:

1) Use the "Create Random Points" tool with constraining feature class set to your polyline, minimum allowed distance set to the distance between line segments you want to split, and number of points set to something very large (the tool will be unable to create all of the points due to the specified minimum distance setting, and this will actually only create a point at your set intervals).

2) Use the "Split Line at Points" tool with input features set to your original polyline and point features set to the output of the "Create Random Points" tool.

This /should/ do what you are looking for. Let me know if this helps!

-Aaron
0 Kudos