# How are two endpoints determined when Dissolving discontinuous line segments to a multipart feature? It seems random, that is, not the geographically opposite ends, as shown in this example.

533
5
11-07-2019 09:21 AM
New Contributor III

Tags (2)
5 Replies
MVP Emeritus

The direction of digitizing has to be continued, I suspect that the first and last points of a segment are checked to see if it connects with the last point of the target segment.  If the order of the points in first segment is are being maintained, then the order of the points in the second segment are flipped IF the last point of the first segment intersects with the last point of the second segment

``````a = [[0, 0], [0, 10]] # ---- append to this segment segment, keep order
b = [[0, 10], [10, 10]] # second segment
c = [[10, 10], [0, 10]] # b, flipped

# append b to a, retain a's order, first point in b
# intersects last point in a
# append c to a, retain c's order, last point in c
# intersects last point in a, hence flip c

result
[[0, 0], [0, 10], [10, 10]  ‍‍‍‍‍‍‍‍‍‍‍``````

If you have a particular case where you think it is random, do you have numbers?  Also, If memory serves coordinates are dealt with from left to right, top to bottom

New Contributor III

Thank you for the insight, Dan, but all of my segment pieces are digitized in the same direction. I'm trying to illustrate that in the following graphic:

MVP Emeritus

If the parts are not connected and dissolved to a multipart shape, what are the order of the parts (left to right, top to bottom as noted previously) or are they seemingly randomly ordered)?  Also, on that note, are the order of the points changed (lines flipped) within each part?

I can't tell that from a figure.  If you want to explore the points, use Feature Vertices to Points for the undissolved version and repeat when the dissolving is done.

MVP Emeritus

Richard Hudson

W‌ell I decided to do a little digging and compare how arcpy implements the output when a dissolve is done.

The attached image shows a sequence of 2 point lines that I constructed.

I got the X, Y coordinate geometry information for each segment.

I performed a dissolve on an attribute field which I had created assigning the same attribute to all the segments in the initial polyline featureclass.

Hope you can see the pattern.

Now, to simplify the analysis, I did a bit of magic and extracted the points in the order that they were created to get the sequent order in the dissolved points.

I then simplified the coordinates to match the bounding box of the points (min = [ 300001., 5000023.]

max = [ 300021., 5000026.]

Here the simplified and shifted coordinates

Initial point orderOld and new order

point id, line that it belongs to and coordinates

``````Point line coords
1       1  [ 0.,  2.],
2       1  [ 8.,  2.],
3       2  [10.,  2.],
4       2  [18.,  2.],
5       3  [20.,  3.],
6       3  [15.,  0.],
7       4  [11.,  0.],
8       4  [ 5.,  0.],
9       5  [ 4.,  0.],
10      5  [ 1.,  1.]])‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍``````
``````Order     Coordinates
new  old
1   9   [[ 4.,  0.],
2  10    [ 1.,  1.],
3   7    [11.,  0.],
4   8    [ 5.,  0.],
5   1    [ 0.,  2.],
6   2    [ 8.,  2.],
7   3    [10.,  2.],
8   4    [18.,  2.],
9   5    [20.,  3.],
10   6    [15.,  0.]])‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍``````

So if the order is important, then you will have to do a lot of work

So is it sorted left bottom to top right?

order of centroids? (don't think so)

But random it isn't

New Contributor III

It's very generous of you, Dan, to keep digging into this. I did some "Feature Vertices to Points" as you suggested, and it seems like the disconnected segments are incorporated into the dissolved multipart feature in the order of lower-right to upper-left starting point. Even if I don't have that exactly correct, the order seems oriented to the spatial location of one end of each of the segments. I tried flipping a couple of the segments, and that had a profound effect on the start/end of the resulting dissolved line. This started as identifying the intersecting streets at the beginning and end of a street network dissolved by Street Name. Using the beginning and ending points of the dissolved lines seemed so simple. Works fine if all pieces of a line are connected.