I have a question and it would really help me if someone could guide me in the right direction. For an analysis in ArcGIS Pro, I need to determine the parallel length between two lines. For the basic approach, I need two distances and one length:
Is there any Tool which can help me with this? Or how would you try to get these results?
There is also a more detailed approach for when the geometry is a bit more messy:
Here you can see that the individual segments are measured. It would be amazing if I could find/make a tool that outputs all the required data. For the visual aspect, I'm also looking for a way to get ArcGIS Pro to draw the a1/a2/... and l1, l2/... lines which I can symbolize as dimensions and label with the Shape_length.
Thank you for reading this, I hope anyone knows anything which can help me start this task! :grinning_face:
No tools that I know of for both cases. You'd have to author them yourself with Python.
Case 1: First thing that came to mind (completely untested):
def parallel_length_between_lines(line, reference_line, distance=None, tolerance=None): """Returns a list of the lengths of the line segments that run parallel to reference_line. The retuned lengths are the lengths of the intersection of line and a buffer around reference_line. A more correct way would be to deconstruct the lines into segments (split at vertices) and then to compare the bearings of those segments. But that would be far more computationally intense and far more difficult to program (I think). line & reference_line: arcpy.Polyline distance: the distance between the lines (the size of the buffer), optional tolerance: relative tolerance by which distance is multiplied (used to fake small variations in the distance as "parallel"), optional """ # calculate distance if not distance: distance = line.distanceTo(reference_line) if not tolerance: tolerance = 0.001 distance *= 1 + abs(tolerance) # create buffer buffer = reference_line.buffer(distance) # line and buffer do not intersect ? -> 0 if line.disjoint(buffer): return 0 # intersect line and buffer segment = line.intersect(buffer, 2) # return segment length # if line is "wavy" compared to reference_line (goes in and out of the buffer), segment will be multipart. Here, I return a list of the singlepart segment lengths, but you could also return the sum or the biggest part segment_lengths = [arcpy.Polyline(segment[p]).length for p in range(segment.partCount)] return segment_lengths
You would then have to apply this function to each line feature in your red feature class, comparing them to the nearest (?) line feature in the purple feature class.
Case 2: Sounds like a **bleep**-ton of math. Maybe arcpy.edit.Generalize could be a start?
Thanks for the suggestion! I'm gonna try this next week!
For Case 2: Yeah, it kinda is. I can program it using Dynamo in Civil 3D, but that's something totally different than Python. Thanks anyway!