<?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>topic Re: Python script to find all layers intersecting a polygon in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035137#M60325</link>
    <description>&lt;P&gt;what do you mean by layer?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 20:48:00 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-03-10T20:48:00Z</dc:date>
    <item>
      <title>Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035134#M60324</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a Python script to find all layers intersecting a polygon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 20:40:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035134#M60324</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2021-03-10T20:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035137#M60325</link>
      <description>&lt;P&gt;what do you mean by layer?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 20:48:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035137#M60325</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-03-10T20:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035152#M60326</link>
      <description>&lt;P&gt;Intersection is an intensive&amp;nbsp; process.&amp;nbsp; There is no simple check, the intersection has to be made and to complicate matters, you need to have an advanced license to perform more than a pairwise intersection.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/polygon.htm" target="_blank"&gt;Polygon—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;in arcpy the polygon class has an intersects method which checks all shapes and performs the intersection.&lt;/P&gt;&lt;P&gt;there is also an "overlaps" property that does a similar thing, but returns a boolean but not the actual intersection (see clarification in that section of the help).&lt;/P&gt;&lt;P&gt;Loading all the layers, setting them selectable, then selecting your polygon in the map would quickly allow you to see whether there is any intersection and the geometry type of the selection.&lt;/P&gt;&lt;P&gt;I won't even address projection differences... a geometry may "intersect" another geometry after projection differences are taken into account.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 21:19:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035152#M60326</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-10T21:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035154#M60327</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From a specific polygon shape in a polygon feature class find all feature classes, points, lines, and polygons, that intersect with the polygon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to find all the assets located in a project (polygon): devices (points), pipes (lines), other polygons (municipality, commission district, etc).&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 21:27:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035154#M60327</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2021-03-10T21:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035164#M60328</link>
      <description>&lt;P&gt;The Select Layer By Location tool allows for an ArcPy Geometry object to be passed as the selecting layer.&amp;nbsp; I would extract the polygon you want, store it in an ArcPy Geometry, then loop through all your feature layers in the map using Select Layer By Location on each one (with mixed geometry types, I would use basic intersection).&amp;nbsp; After running Select Layer By Location, you run Get Count to see how many features were selected.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 21:58:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035164#M60328</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-03-10T21:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035175#M60329</link>
      <description>&lt;P&gt;I'm wondering what is meant by 'looking for'....&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 22:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035175#M60329</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-03-10T22:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035224#M60330</link>
      <description>&lt;P&gt;I did this not too long ago and thought I'd share the code.&amp;nbsp; Had to compare two featureclasses of polygons for intersecting features so I looped through one to select the other/ count the other like&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt; described.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def intersectLayers():
    bldgFp = os.path.join(wrkingdb, r'bldg_footprints')
    bldgFP_Lyr = arcpy.MakeFeatureLayer_management(bldgFp, "bldgFP_lyr")

    with arcpy.da.SearchCursor(pictBldgFP, ['OBJECTID', 'SHAPE@']) as cur:
        for row in cur:
            curIntersect = arcpy.SelectLayerByLocation_management(bldgFP_Lyr, "INTERSECT", row[1], '', 'NEW_SELECTION')
            intersectCnt = int(arcpy.GetCount_management(curIntersect).getOutput(0))

            if intersectCnt &amp;gt; 0:
                print(f'{row[0]} intersects with {intersectCnt} features')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 23:32:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035224#M60330</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-10T23:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035429#M60335</link>
      <description>&lt;P&gt;JeffK thanks for sharing.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 14:06:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1035429#M60335</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2021-03-11T14:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1099726#M62492</link>
      <description>&lt;P&gt;Nice work, Jeff!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 01:38:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1099726#M62492</guid>
      <dc:creator>JohnMorgan</dc:creator>
      <dc:date>2021-09-20T01:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python script to find all layers intersecting a polygon</title>
      <link>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1099851#M62497</link>
      <description>&lt;P&gt;I will just add that if you are working with a lot of features it may help to divide and conquer with a subsection first such as&amp;nbsp;&lt;/P&gt;&lt;P&gt;intersect_lyr = arcpy.SelectLayerByLocation_management(one_fc, 'INTERSECT', two_fc)&lt;/P&gt;&lt;P&gt;Derek&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 12:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-to-find-all-layers-intersecting-a/m-p/1099851#M62497</guid>
      <dc:creator>JohnMorgan</dc:creator>
      <dc:date>2021-09-20T12:41:54Z</dc:date>
    </item>
  </channel>
</rss>

