<?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: Inconsistent Select By Location behavior in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134183#M10504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;For the purposes of discussion, building a Topology is not an option, otherwise this exercise would be easy.&lt;BR /&gt;&lt;BR /&gt;I am performing the same Select By Location two different ways. &lt;BR /&gt;&lt;BR /&gt;The first method, let's say Method A, is performed manually, using the Select By Location icon in ArcMap. I am selecting line features from LayerL that intersect point features from LayerP. A review of the selection seems to indicate that results are accurate and expected.&lt;BR /&gt;&lt;BR /&gt;The second method, let's say Method B, is performed via a Python script. Below is a code snippet&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lyrL = arcpy.GetParameterAsText(0)
lyrP = arcpy.GetParameterAsText(1)
arcpy.SelectLayerByLocation_management(lyrL, "INTERSECT", lyrP, "", "NEW_SELECTION")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Method B does *NOT* return the same selection as Method A. The results of this selection are dubious, as many line features are not selected that do, in fact, intersect points, as well as many line features that are selected that do NOT intersect points.&lt;BR /&gt;&lt;BR /&gt;I am thinking this might be a tolerance issue, but I can't find anything to support my theory. Anybody have an idea why this is, or has anybody experienced this before?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are both lyrL and lyrP in the same spatial reference?&amp;nbsp; (just a hunch and something to dbl-chk)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:30:43 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-12-11T07:30:43Z</dc:date>
    <item>
      <title>Inconsistent Select By Location behavior</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134182#M10503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For the purposes of discussion, building a Topology is not an option, otherwise this exercise would be easy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am performing the same Select By Location two different ways. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first method, let's say Method A, is performed manually, using the Select By Location icon in ArcMap. I am selecting line features from LayerL that intersect point features from LayerP. A review of the selection seems to indicate that results are accurate and expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second method, let's say Method B, is performed via a Python script. Below is a code snippet&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;lyrL = arcpy.GetParameterAsText(0)
lyrP = arcpy.GetParameterAsText(1)
arcpy.SelectLayerByLocation_management(lyrL, "INTERSECT", lyrP, "", "NEW_SELECTION")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Method B does *NOT* return the same selection as Method A. The results of this selection are dubious, as many line features are not selected that do, in fact, intersect points, as well as many line features that are selected that do NOT intersect points.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am thinking this might be a tolerance issue, but I can't find anything to support my theory. Anybody have an idea why this is, or has anybody experienced this before?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 20:48:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134182#M10503</guid>
      <dc:creator>GlennKammerer</dc:creator>
      <dc:date>2013-05-15T20:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent Select By Location behavior</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134183#M10504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;For the purposes of discussion, building a Topology is not an option, otherwise this exercise would be easy.&lt;BR /&gt;&lt;BR /&gt;I am performing the same Select By Location two different ways. &lt;BR /&gt;&lt;BR /&gt;The first method, let's say Method A, is performed manually, using the Select By Location icon in ArcMap. I am selecting line features from LayerL that intersect point features from LayerP. A review of the selection seems to indicate that results are accurate and expected.&lt;BR /&gt;&lt;BR /&gt;The second method, let's say Method B, is performed via a Python script. Below is a code snippet&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lyrL = arcpy.GetParameterAsText(0)
lyrP = arcpy.GetParameterAsText(1)
arcpy.SelectLayerByLocation_management(lyrL, "INTERSECT", lyrP, "", "NEW_SELECTION")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Method B does *NOT* return the same selection as Method A. The results of this selection are dubious, as many line features are not selected that do, in fact, intersect points, as well as many line features that are selected that do NOT intersect points.&lt;BR /&gt;&lt;BR /&gt;I am thinking this might be a tolerance issue, but I can't find anything to support my theory. Anybody have an idea why this is, or has anybody experienced this before?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are both lyrL and lyrP in the same spatial reference?&amp;nbsp; (just a hunch and something to dbl-chk)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:30:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134183#M10504</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T07:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent Select By Location behavior</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134184#M10505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The two feature classes in question are in the same feature dataset, so yes they are the same projection. And the data frame projection is the same as the feature dataset's, so I know it's not a projection issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2013 20:39:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134184#M10505</guid>
      <dc:creator>GlennKammerer</dc:creator>
      <dc:date>2013-05-20T20:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent Select By Location behavior</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134185#M10506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The two feature classes in question are in the same feature dataset, so yes they are the same projection. And the data frame projection is the same as the feature dataset's, so I know it's not a projection issue.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you suspect the tolerance is the issue, perhaps you can attempt to select by location with a search distance parameter.&amp;nbsp; Something like (untested):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

arcpy.SelectLayerByLocation_management(lyrL, "WITHIN_A_DISTANCE", lyrP, 2, "NEW_SELECTION")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a bit unsure of the linear unit you should set and the above is untested only pulled from the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000072000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000072000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry --- I just don't have specific experience with this scenario.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;j&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:30:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-select-by-location-behavior/m-p/134185#M10506</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T07:30:45Z</dc:date>
    </item>
  </channel>
</rss>

