<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>idea Polylines touch and cross behaviour in Python Ideas</title>
    <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idi-p/1561117</link>
    <description>&lt;P&gt;Given two arcpy.Polyline geometries.&lt;/P&gt;&lt;P&gt;If they only touch each other:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;poly1.touches(poly2) == True&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if poly2 touches and at the same time crosses poly1:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;poly1.touches(poly2) == False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;poly1.crosses(poly2) == True&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Therefore, I offer to change the logic. If they touch - it's True, whatever other relations they have.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2024 04:28:41 GMT</pubDate>
    <dc:creator>EugeneSosnin_GSI</dc:creator>
    <dc:date>2024-11-21T04:28:41Z</dc:date>
    <item>
      <title>Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idi-p/1561117</link>
      <description>&lt;P&gt;Given two arcpy.Polyline geometries.&lt;/P&gt;&lt;P&gt;If they only touch each other:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;poly1.touches(poly2) == True&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if poly2 touches and at the same time crosses poly1:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;poly1.touches(poly2) == False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;poly1.crosses(poly2) == True&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Therefore, I offer to change the logic. If they touch - it's True, whatever other relations they have.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 04:28:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idi-p/1561117</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2024-11-21T04:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1561994#M392</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Check if the polylines touch&lt;BR /&gt;touches = poly1.touches(poly2)&lt;/P&gt;&lt;P&gt;# Check if the polylines cross&lt;BR /&gt;crosses = poly1.crosses(poly2)&lt;/P&gt;&lt;P&gt;# Modify the logic to return True if they touch, regardless of crossing&lt;BR /&gt;if touches or crosses:&lt;BR /&gt;return True&lt;BR /&gt;else:&lt;BR /&gt;return False&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2024 01:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1561994#M392</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-11-24T01:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562313#M393</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for the answer. Unfortunately, it does not apply to the condition of the problem.&lt;/P&gt;&lt;P&gt;The condition: &lt;STRONG&gt;two polylines touch and cross at the same time&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EugeneSosnin_GSI_0-1732558701891.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120374i0B941BF2FEAF34B2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EugeneSosnin_GSI_0-1732558701891.png" alt="EugeneSosnin_GSI_0-1732558701891.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EugeneSosnin_GSI_1-1732558749258.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120375iDFD1B517B451543B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EugeneSosnin_GSI_1-1732558749258.png" alt="EugeneSosnin_GSI_1-1732558749258.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 18:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562313#M393</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2024-11-25T18:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562325#M394</link>
      <description>&lt;P&gt;Have you tried changing&amp;nbsp;&lt;SPAN class=""&gt;if&lt;/SPAN&gt; touches &lt;STRONG&gt;&lt;SPAN class=""&gt;or&lt;/SPAN&gt;&lt;/STRONG&gt; crosses: to &lt;SPAN class=""&gt;if&lt;/SPAN&gt; touches &lt;SPAN class=""&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;/SPAN&gt; crosses:&amp;nbsp;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;# Check if the polylines touch
touches = poly1.touches(poly2)

# Check if the polylines cross
crosses = poly1.crosses(poly2)

# Modify the logic to return True if they touch, regardless of crossing
if touches and crosses:
return True
else:
return False&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 18:34:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562325#M394</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-11-25T18:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562376#M395</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;With all respect I tried, and obviously it did not work.&lt;/P&gt;&lt;P&gt;touches is False, crosses is True. Boolean algebra is clear with &lt;STRONG&gt;Logical And&lt;/STRONG&gt;: &lt;STRONG&gt;False and True&lt;/STRONG&gt; returns &lt;STRONG&gt;False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The problem is not in Boolean algebra, but in ArcPy logic: if a polyline crosses another it will never return touches True.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 19:28:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562376#M395</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2024-11-25T19:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562449#M396</link>
      <description>&lt;P&gt;I did some testing on some code and here are my results, hopefully it helps.&lt;/P&gt;&lt;P&gt;Found crossing polylines: OID1=2, OID2=3&lt;BR /&gt;Found touching polylines: OID1=2, OID2=5&lt;BR /&gt;Found crossing polylines: OID1=3, OID2=2&lt;BR /&gt;Found touching polylines: OID1=3, OID2=4&lt;BR /&gt;Polylines overlap (intersection) found: OID1=3, OID2=6&lt;BR /&gt;Found touching polylines: OID1=4, OID2=3&lt;BR /&gt;Found touching polylines: OID1=4, OID2=5&lt;BR /&gt;Found touching polylines: OID1=5, OID2=2&lt;BR /&gt;Found touching polylines: OID1=5, OID2=4&lt;BR /&gt;Polylines overlap (intersection) found: OID1=6, OID2=3&lt;BR /&gt;Intersection features saved to in_memory/intersect_output.&lt;BR /&gt;Finished processing.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy

# Set the layer containing the line features
layer = "LineTest"

# Temporary output to store intersections (optional)
intersect_output = "in_memory/intersect_output"

# Loop through the features in the layer using a search cursor
with arcpy.da.SearchCursor(layer, ["SHAPE@", "OID@"]) as cursor1:
    for row1 in cursor1:
        poly1 = row1[0]
        oid1 = row1[1]
        with arcpy.da.SearchCursor(layer, ["SHAPE@", "OID@"]) as cursor2:
            for row2 in cursor2:
                poly2 = row2[0]
                oid2 = row2[1]
                if oid1 != oid2:  # Skip comparing the same feature
                    # Check if the two polylines cross
                    if poly1.crosses(poly2):
                        print(f"Found crossing polylines: OID1={oid1}, OID2={oid2}")
                    
                    # Check if the two polylines touch at any point
                    if poly1.touches(poly2):
                        print(f"Found touching polylines: OID1={oid1}, OID2={oid2}")
                    
                    # Check if the two polylines actually intersect (overlap)
                    if poly1.overlaps(poly2):  # Checks if they intersect and share some space
                        print(f"Polylines overlap (intersection) found: OID1={oid1}, OID2={oid2}")

# Optionally, create a layer to show all intersections for review
#arcpy.analysis.Intersect([layer], intersect_output, "ALL", None, "LINE")
print(f"Intersection features saved to {intersect_output}.")
print("Finished processing.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LineTest - ArcGIS Pro_ Intersect.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120415iAA32E4D59AB7C45F/image-size/large?v=v2&amp;amp;px=999" role="button" title="LineTest - ArcGIS Pro_ Intersect.png" alt="LineTest - ArcGIS Pro_ Intersect.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LineTest - ArcGIS Pro_ OverlapTouch.png" style="width: 942px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120416i333EB54EC36C3993/image-size/large?v=v2&amp;amp;px=999" role="button" title="LineTest - ArcGIS Pro_ OverlapTouch.png" alt="LineTest - ArcGIS Pro_ OverlapTouch.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 21:49:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562449#M396</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-11-25T21:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562470#M397</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;, I am sorry, but it does not help.&lt;/P&gt;&lt;P&gt;Frankly, I even don't understand which polyline is which on your plot. Seems like instead of having one polyline, you created three: 6,3,2. Other polylines seems to be similar. It's completely irrelevant to my case.&amp;nbsp;I showed you a simple example of two polyline, that touch and cross each other simultaneously. And they will never return touches==True, unless crossing is False. Simple.&lt;/P&gt;&lt;P&gt;I beg you, please, delete your messages, as they are misleading. I will delete my answers.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 22:10:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562470#M397</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2024-11-25T22:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562480#M398</link>
      <description>&lt;P&gt;So much for trying to help.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 23:11:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562480#M398</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-11-25T23:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562505#M399</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;I didn't ask for it. This section is "Python Ideas" where I asked developers to change the logic of a method.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 00:31:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1562505#M399</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2024-11-26T00:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1563907#M403</link>
      <description>&lt;P&gt;Breaking arcpy backwards compatibility to fix ill-defined logic issues is at the bottom of ESRI's priority list. You'd be better off posting the actual problem you're trying to solve in one of the communities, chances are there's a fix for whatever the root issue is.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 22:44:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1563907#M403</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2024-12-02T22:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1563933#M404</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/4413"&gt;@DavidSolari&lt;/a&gt;&amp;nbsp;, I am patient&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 00:29:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1563933#M404</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2024-12-03T00:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1572203#M410</link>
      <description>&lt;P&gt;By definition, if two polylines cross, then they don't touch and vice versa. Here's how it works. The interior of a polyline is the set of points in the polyline that are not start or end points of a path. If the intersection of the interiors is empty, but the intersection of the polylines is not empty (they intersect only at start or end points of a path), then the polylines touch. Two polylines cross if they meet at points only, and at least one of the shared points is internal to both polylines.&lt;BR /&gt;See &lt;A href="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProConcepts-Geometry#predefined-relational-operations" target="_self"&gt;https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProConcepts-Geometry#predefined-relational-operations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For your case, you can use the Relation operator. See &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.geometry.html#relation" target="_self"&gt;https://developers.arcgis.com/python/latest/api-reference/arcgis.geometry.html#relation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 18:21:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1572203#M410</guid>
      <dc:creator>AnnetteLocke</dc:creator>
      <dc:date>2025-01-02T18:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1573612#M415</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/47911"&gt;@AnnetteLocke&lt;/a&gt;&amp;nbsp;, thank you for the answer. I got your point, and I appreciate the tip for using Relation operator in ArcGIS API for Python. Thought, could we do something with Arcpy? Like add a Relation method to Arcpy, or a parameter to the &lt;STRONG&gt;touch&lt;/STRONG&gt; method to find true relation, even if interiors intersect? Please.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 17:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1573612#M415</guid>
      <dc:creator>EugeneSosnin_GSI</dc:creator>
      <dc:date>2025-01-08T17:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1573734#M416</link>
      <description>&lt;P&gt;Eugene, thank you for the suggestion. The Relation method will be added to ArcPy in a future release.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 20:41:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1573734#M416</guid>
      <dc:creator>AnnetteLocke</dc:creator>
      <dc:date>2025-01-08T20:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour - Status changed to: Under Consideration</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1574048#M419</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You've got our attention!&amp;nbsp; We think this is a good suggestion and have entered it in our backlog.&amp;nbsp; We encourage the community&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;to continue voting and sharing feedback which will help teams gauge user demand.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 17:49:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1574048#M419</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2025-01-09T17:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour - Status changed to: Open</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1656159#M523</link>
      <description>&lt;P&gt;I believe this behavior is based on&amp;nbsp;&lt;A href="https://en.wikipedia.org/wiki/DE-9IM" target="_blank"&gt;https://en.wikipedia.org/wiki/DE-9IM&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Oct 2025 09:19:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1656159#M523</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2025-10-08T09:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines touch and cross behaviour - Status changed to: Under Consideration</title>
      <link>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1656415#M524</link>
      <description>&lt;P&gt;Status was mistakenly moved to "Open" state, placing issue back into "Under Consideration" state.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Oct 2025 19:00:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/polylines-touch-and-cross-behaviour/idc-p/1656415#M524</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2025-10-08T19:00:56Z</dc:date>
    </item>
  </channel>
</rss>

