2

I have a polyline shapefile with the following attributes: start elevation, end elevation, slope and length. I need to split the lines at a specific elevation, using ArcGIS. Essentially, if my line start elev at 79.38m
end elev at 79.19 length of 144m slope of 0.00132

How can I split the line at an elevation of 79.25m? Is there a tool in ArcGIS that will interpolate the line based on the available information and split the line at the location where 79.25m occurs?

  • Please choose a single software. Questions asking for solutions in multiple programs will be closed as "too broad" per this site's "one question per question" policy. – csk Jan 15 '19 at 17:12
1

You can use arcpy. Code below will check Z-values along the line length step by step and split the line (and output a new split feature class) at the Z-value closest to your desired Z. It might not give you exactly the right split position but if you keep the step value as low as possible it should be very Close. With 0.1 m step value i got the split at exactly Z 79.25

import arcpy

fc = r'Polyline_with_Z' #Change
desired_z = 79.25 #Change
step = 0.1 #Change, as small as possible without making the execution time unacceptably long
out_fc = r'in_memory\split_lines'#Change

geom = [i[0] for i in arcpy.da.SearchCursor(fc,"SHAPE@")][0] #If you have more than one line in the in fc you will have to modify this line and code below
points = []
position = 0
while position < geom.length:
    points.append(geom.positionAlongLine(position))
    position+=step

bestpoint = min(points, key=lambda x: abs(x.centroid.Z-desired_z))
arcpy.CopyFeatures_management(in_features=bestpoint, out_feature_class=r'in_memory\bestpoint')
arcpy.SplitLineAtPoint_management(in_features=fc, point_features=r'in_memory\bestpoint', 
                                 out_feature_class=out_fc)

enter image description here

| improve this answer | |
  • 1
    Thank you so much this is great! I never even thought to make script...because I'm not very comfortable with arcpy. – user132003 Jan 16 '19 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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