3

Trying to figure out how to edit a self intersecting polyline (Interstate Ramp) such that I end up with a from node, self intersection loop, then end node.

enter image description here

I'm using ArcGIS Version 10.3 and the data is stored in a Feature Class of a File Geodatabase

Richard. Great and insightful comments, but I think I found a solution from which we both might find useful. I found that if, as you stated, I create two features, then retrace the features (ramp), then delete the underlying features I was left with one self-intersecting line that appears to work fine in network analyst (See Figure). The only issue I have now is when I trace the new feature I lose all attribution so I suspect some sort of join to repopulate the attributes.

enter image description here

To copy attributes from one feature to another feather I used the following procedure ....

1.Click the Editor menu and click Start Editing.

2.Click the Edit tool Edit tool on the Editor toolbar.

3.Select the features whose attributes you want to edit.

4.Click the Attributes button Attributes button on the Editor toolbar.

5.In the Attributes dialog box, right-click the feature you want to copy from and click Copy.

6.Right-click the feature you want to paste into and click Paste.

  • ArcGIS Version 10.3 (typo); Feature Class. – Jeff Aug 14 '15 at 23:56
  • Select line, use advanced edit > planarise – FelixIP Aug 15 '15 at 2:55
  • Planarise will simply split the line into sections. I'm wanting one single feature (Line). – Jeff Aug 15 '15 at 5:00
  • OP is misleading. If picture shows 3 lines, they are not what called exactly self-intersecting... Merge them one by one in desired order – FelixIP Aug 15 '15 at 5:02
  • I've tried merging . End up with a multipart feature – Jeff Aug 15 '15 at 5:35
3

If you create a single polyline feature from the lines shown, a multipart feature will always be created. This rule concerning self-intersecting features is built-in to the Esri specifications for a polyline and cannot be overridden. Polygons are made from closed polylines and polygons must force a multi-part polyline feature at self-intersections to draw properly. Permitting unbroken self-intersections of a single part line would result in both sides of the line forming the interior and exterior of the polygon simultaneously (somewhat akin to a mobius strip), and that is not allowed. Esri decided to enforce that rule for all polylines.

I have simply accepted that I have to create two features always for loop ramp lines to ensure they are oriented correctly. I always split such lines somewhere within the loop. I use an attribute specific to that line pair to allow my python code or geoprocessing tools to understand that analytically I want the line pair treated as a single line for the purposes of finding the end points that begin and end the transition from one highway to the other. For a direction attribute I assign both segments with the final line end direction (SW in your example) even though one of the lines may have its end pointing in a different direction (although in your example you can create the line break just prior to the self intersection so that both lines have their ends pointing SW).

Additionally, there is no way to use the Create Route tool with such loops to form a single route without creating completely unusable routes. The Create Routes algorithm converts all self-intersecting lines into multipart lines for each vertice pair segment and scrambles the segment part sequence. Since I see no value in maintaining my routes using manual editing and rely on an automated process to completely regenerate my routes each week, I create two separate routes with a similar route name from the two lines I have broken in the loop. Of course if you do not rely on automated maintenance you can manually edit the lines to get mostly useable measures, but it is time consuming to do such edits and they will still report complex measures at the point of intersection.

Jeff: Interesting behavior with the trace tool. I was not aware that it behaved differently from the normal drawing tools. In my case, I currently don't use Network Analyst and primarily use LR. I tested a single part line ramp loop shape created using the trace tool with the Create Route tool to assign measures. The Create Route output was also a single part line and the measures were assigned correctly through the self-intersection in the same way it would for any normal line without self-intersections. That additional step during editing to create features is not too difficult or time consuming. I will most likely recreate my ramps using this technique.

As far as attributes from the original lines, I would use the Attribute Transfer tool on the Spatial Adjustment toolbar. That method will add just a few more clicks during your editing of the feature to transfer the attributes. It is easier than managing a separate feature class created using a join attribute or a spatial join.

  • Again thank you for your insights. I just became aquatinted with the "Transfer Attribute Tool." So I will look into its usage. Yes the Trace Feature provided unexpected and interesting results. – Jeff Aug 15 '15 at 16:46
  • I am sure that if you ran Simplify on the self-intersecting single part line you have created, a multpart feature would be created to replace it, since Esri would regard your line as a complex shape. Apparently their other tools apply an internal Simplify step before storing the shape, but the trace tool does not. Most likely this behavior is just a fortunate oversight on Esri's part. Hopefully, Esri won't decide to "fix" it should they see this. At the same time, many geoprocessing tools do apply a simplify step, so do not be surprised if the shape does not survive after using some tools. – Richard Fairhurst Aug 15 '15 at 16:58
  • Yes I ran Simplify and obtained the results you indicated. Regarding oversight - yes hope ESRI doesn't fix it. Fortunately I only have a couple of the ramp issues out of several thousand. Great and useful comments. – Jeff Aug 15 '15 at 17:03
  • So I guess it is more accurate to say that the rule concerning the conversion of self-intersecting features into multipart features is built into the Esri Simplify specifications for a polyline and will be applied anywhere the Simplify algorithm is built-in. – Richard Fairhurst Aug 15 '15 at 17:05
0

Wow! Never thought it is that complicated. To pay for my arrogance I wrote a script that handles this. Script assumes that 1st layer in TOC is target polyline layer. Tool parameters script gets selection and populates one and the only script parameter (Type Long, MultiValue = Yes).

Validation script:

  def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""
    mxd = arcpy.mapping.MapDocument("CURRENT")
    lyr = arcpy.mapping.ListLayers(mxd)[0]
    d=arcpy.Describe(lyr)
    aBmNodes=d.FIDset
    self.params[0].value=aBmNodes
    self.params[0].enabled=1
    return

User have to shuffle selected lines FIDs in correct order, e.g. for 3 selected lines shown below:

enter image description here

the correct order is:

enter image description here

Script to be attached to the tool:

import arcpy, traceback, os, sys

try:
    def showPyMessage():
        arcpy.AddMessage(str(time.ctime()) + " - " + message)
        aBmLinks = arcpy.GetParameterAsText(0)
    aBmLinks=aBmLinks.split(';')
        nSet=len(aBmLinks)
    if nSet<2:
                arcpy.AddWarning("Please select at least 2 lines")
                raise SystemExit('Missing input')
    mxd = arcpy.mapping.MapDocument("CURRENT")
        lyr = arcpy.mapping.ListLayers(mxd)[0]
        d=arcpy.Describe(lyr);fidName=d.OIDFieldName
        first = arcpy.AddFieldDelimiters(lyr.workspacePath, fidName)
        arr=arcpy.Array()
        for fid in aBmLinks:
                quer='%s=%s'%(first,fid)
                with arcpy.da.SearchCursor(lyr, ("OID@","Shape@"),quer,explode_to_points=True) as cursor:
                    for row in cursor:
                        arr.add(row[1].firstPoint)

#        pLine=arcpy.Polyline(arr)
#        with arcpy.da.UpdateCursor(lyr,"Shape@",quer) as curT:
#                for row in curT:curT.updateRow((pLine,))

except:
    message = "\n*** PYTHON ERRORS *** "; showPyMessage()
    message = "Python Traceback Info: " + traceback.format_tb(sys.exc_info()[2])[0]; showPyMessage()
    message = "Python Error Info: " +  str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"; showPyMessage()

Uncomment last 3 line, and it will replace the geometry of last feature in sorted list (FID=0 in example shown) by single part polyline.

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.