Find parallel lines and export data

463
3
06-11-2021 02:40 AM
Labels (2)
Basbo
by
New Contributor

Hello everyone,

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:

Basbo_0-1623403589169.png

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:

Basbo_1-1623403863250.png

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.

In short:

  1. Is there a tool which I can use to get the basic parallel results from image 1?
    • If 1. is a no, how could I make such a tool?
  2. Is there a tool which I can use to get the detailed parallel results from image 2?
    • If 2. is a no, how could I make such a tool?

Thank you for reading this, I hope anyone knows anything which can help me start this task! :grinning_face:

0 Kudos
3 Replies
JohannesLindner
MVP Regular Contributor

Interesting problem...

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?


Have a great day!
Johannes
Basbo
by
New Contributor

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!

0 Kudos
SarahHartholt
Occasional Contributor III

can't this be achieved with dimensions? I don't think it is possible for ArcGIS Pro to draw the lines for you though  Dimensions in ArcGIS Pro—ArcGIS Pro | Documentation

0 Kudos