<?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 select features just interiors of geometry intersect in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484407#M37818</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, but you might have to use several operators to get exactly what you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Look up the SelectByLocation help for some useful diagrams.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ended up having to select intersections, then snap a temporary subset, select outside or touching, then use those that are just touching or intersecting to remove from the original set. I used select by attributes using an sql query having created an expression with the touching features.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Mar 2013 02:23:30 GMT</pubDate>
    <dc:creator>KimOllivier</dc:creator>
    <dc:date>2013-03-01T02:23:30Z</dc:date>
    <item>
      <title>python select features just interiors of geometry intersect</title>
      <link>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484406#M37817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does python provide funtion to select features jjust interiors of geometry intersect? Similar like ArcOject esriSeptialRelationEnum = 2 which Intersection excluding boundary touch. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I try to several ways and can't figure it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any idea?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;choilon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 02:11:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484406#M37817</guid>
      <dc:creator>longcui</dc:creator>
      <dc:date>2013-03-01T02:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: python select features just interiors of geometry intersect</title>
      <link>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484407#M37818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, but you might have to use several operators to get exactly what you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Look up the SelectByLocation help for some useful diagrams.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ended up having to select intersections, then snap a temporary subset, select outside or touching, then use those that are just touching or intersecting to remove from the original set. I used select by attributes using an sql query having created an expression with the touching features.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 02:23:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484407#M37818</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2013-03-01T02:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: python select features just interiors of geometry intersect</title>
      <link>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484408#M37819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Kimo&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for your answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried to select intersect, then remove all touching boundary, then add containing and add within. That still miss scenario like two features share boundary and interior, but not contain each other. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you select all intersect,then remove all touching, you may delete correct features like feature within and share a boundary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know how to select outside by selectbylocation&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 03:51:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484408#M37819</guid>
      <dc:creator>longcui</dc:creator>
      <dc:date>2013-03-01T03:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: python select features just interiors of geometry intersect</title>
      <link>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484409#M37820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I used the diagrams in the help called Select By Location: graphic examples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;These have nice summaries of each selection operator summaries in a set of diagrams A - M&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Suppose you want to exclude polygons touching on the outside (diagram I)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Case I is covered in INTERSECT, BOUNDARY_TOUCHES, SHARE_A_LINE_SEGMENT_WITH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Other operators do not include diagram I so you add and remove using other operators until you are left with case I.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I made up a matrix of the letters so that I could see which ones to add or subtract.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since we do not want to confuse the list with features that are not touching at all, I start with an intersect subset and make a temporary featureclass. At the end I simply get the remaining keys (par_id) of the features required and make a normal SQL selection using a "KEY IN (key,key,key)" expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This snippet of code illustrates the flaming hoops that you have to jump through compared to ARC/INFO coverage selections.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Since the new data is not topologically correct I have to add a snap as well to avoid errors from sliver overlaps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# ...snip 
# get all intersections ACDEFGHIJKM (see help diagrams for letters)
arcpy.management.SelectLayerByLocation(fcLayer,'INTERSECT',gaLayer,selection_type='NEW_SELECTION')
# copy to a temp layer, snap, then remove those outside but touching
snapFC = prefix+fcAbbrev+"_snap"
arcpy.management.CopyFeatures(fcLayer,snapFC)
arcpy.management.MakeFeatureLayer(snapFC,touchLayer) # Have no selection to start
arcpy.management.SelectLayerByLocation(gaLayer,'INTERSECT',fcLayer,selection_type='ADD_TO_SELECTION')
arcpy.edit.Snap(touchLayer,[[gaLayer,'VERTEX',4],[gaLayer,'EDGE',4]])
# get outside touching to exclude DIJ (help diagram cases)
arcpy.management.SelectLayerByLocation(touchLayer,'BOUNDARY_TOUCHES',gaLayer,selection_type='NEW_SELECTION')
arcpy.management.SelectLayerByLocation(touchLayer,'WITHIN',gaLayer,selection_type='REMOVE_FROM_SELECTION')
arcpy.management.SelectLayerByLocation(touchLayer,'CONTAINS',gaLayer,selection_type='REMOVE_FROM_SELECTION')
# subtract outside touching if any DIJ (see help)
cTouch = int(arcpy.management.GetCount(touchLayer).getOutput(0))
if cTouch == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.analysis.SpatialJoin(fcLayer,gaLayer, prefix+fcAbbrev,'JOIN_ONE_TO_MANY','KEEP_COMMON',"#",'INTERSECT')
&amp;nbsp;&amp;nbsp;&amp;nbsp; count = int(arcpy.management.GetCount(prefix+fcAbbrev).getOutput(0))
&amp;nbsp;&amp;nbsp;&amp;nbsp; if count &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dCount[fcAbbrev] = count
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg = "GA %s %s %s %d" % (aggregate_area,arcpy.management.GetCount(gaLayer),fcAbbrev,dCount[fcAbbrev])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.info(msg)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print msg
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.Delete(prefix+fcAbbrev)
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lstPar = [row.par_id for row in arcpy.SearchCursor(touchLayer)]
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(lstPar) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(lstPar) == 1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expr = "PAR_ID = "+str(lstPar[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expr = "PAR_ID in "+str(tuple(lstPar))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # print "touching outside",cTouch #,expr
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # remove from list of new parcels of interest
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.SelectLayerByAttribute(fcLayer,"REMOVE_FROM_SELECTION",expr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "error",expr
&amp;nbsp;&amp;nbsp;&amp;nbsp; #
&amp;nbsp;&amp;nbsp;&amp;nbsp; if int(arcpy.management.GetCount(fcLayer).getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.analysis.SpatialJoin(fcLayer,gaLayer, prefix+fcAbbrev,'JOIN_ONE_TO_MANY','KEEP_COMMON',"#",'INTERSECT')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = int(arcpy.management.GetCount(prefix+fcAbbrev).getOutput(0))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if count &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dCount[fcAbbrev] = count
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # tag touched GA layers
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.SelectLayerByLocation(gaLayer,'INTERSECT',fcLayer,selection_type='ADD_TO_SELECTION')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg = "GA %s %s %s %d" % (aggregate_area,arcpy.management.GetCount(gaLayer),fcAbbrev,dCount[fcAbbrev])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.info(msg)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print msg
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.Delete(prefix+fcAbbrev)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:21:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484409#M37820</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2021-12-11T21:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: python select features just interiors of geometry intersect</title>
      <link>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484410#M37821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Kimo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the diagrams from A-M do not include the scenario like the two features intersect and share boundary, but not contain each other (like the image attached). In that case, when exclude DJI, this scenario is excluded as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]22359[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Long&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 22:02:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484410#M37821</guid>
      <dc:creator>longcui</dc:creator>
      <dc:date>2013-03-04T22:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: python select features just interiors of geometry intersect</title>
      <link>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484411#M37822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, that is easy to select. You just have to do your own logic with the selected sets to add or subtract until you are left with the cases you are interested in. If you can logically describe to me what you need, you can create a program to do the same. That is what makes programming so fascinating. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First you select intersected features (INTERSECT), and from that subset (using a layer) you select features that are touching (BOUNDARY_TOUCHES).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can then also remove contained polygons from the selection using CONTAINS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my case I made up a separate selection to identify a group that I did not want (touching but outside) and used an attribute selection to remove them from the intersecting and inside set.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It does not matter that an operator selects other cases you are not interested in if you have already selected them out so that you know that those cases do not apply for your set.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try it interactively using the SelectbyLocation option on some samples to get the logic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 07:07:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-features-just-interiors-of-geometry/m-p/484411#M37822</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2013-03-05T07:07:08Z</dc:date>
    </item>
  </channel>
</rss>

