<?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: Select polygon under feature set point in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410487#M32370</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was able to reproduce this behavior when the data frame is set to a different coordinate system than the feature class the selection is applied to.&amp;nbsp; I was able to workaround this by going into the Environments &amp;gt; Output Coordinates and changing Output Coordinate System to 'Same as Display'.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Mar 2012 10:02:46 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2012-03-21T10:02:46Z</dc:date>
    <item>
      <title>Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410479#M32362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying basically copy the selectlayerbylocation functionality but using a point from a feature set as my input but after trying a few different things I can't get my script to select a polygon under the point in the same way select layer by location does.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have any idea how to do this under arcpy?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 03:37:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410479#M32362</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-03-19T03:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410480#M32363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Stephen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

# Script arguments
Point_Selection = arcpy.GetParameterAsText(0)

Polygon_Selection = arcpy.GetParameterAsText(1)

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Polygon_Selection, "INTERSECT", Point_Selection, "", "NEW_SELECTION")

arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you can import the script into a toolbox and set the parameters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]12802[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the Feature Set, be sure to set the 'schema' to an existing shapefile/feature class.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:38:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410480#M32363</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T18:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410481#M32364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your response and suggestion, unfortunately this matches what I have tried and although the code completes successfully nothing is selected in the polygon featureclass or shapefile underneath either onscreen or in the attribute table.&amp;nbsp; Is there something else I need to do?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 20:40:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410481#M32364</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-03-19T20:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410482#M32365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Interestingly if I apply a GetCount_management to the selection layer it returns 0 records even though there are 40308 features within, the feature set returns the correct number of features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Further testing- if I add the polygon fc and run the script the correct number of features is returned by the count but on a second run straight after the count is back to 0, in both cases still no selected polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only hint I get (and this may not be relevant) is that the tool messages include this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing: SelectLayerByLocation AHGFContractedCatchment INTERSECT in_memory\{68DDA71F-1C9E-4477-A9EE-4746D9B0F4E3} # NEW_SELECTION&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Which may mean that this is becoming an in memory process and not transferred to the activeview?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you can see my code is practically the same as your suggestion:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
features = arcpy.GetParameterAsText(0)
layertoSelect = arcpy.GetParameterAsText(1)
result = arcpy.GetCount_management(layertoSelect)
arcpy.AddMessage("x = " + str(result.getOutput(0)))
arcpy.SelectLayerByLocation_management(layertoSelect,"INTERSECT",features,"","NEW_SELECTION")
for m in range(0,arcpy.GetMessageCount()-1):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(arcpy.GetMessage(m))
arcpy.RefreshActiveView()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:38:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410482#M32365</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2021-12-11T18:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410483#M32366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you send a screen shot of your Parameters tab within the Script's properties?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 09:36:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410483#M32366</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-03-20T09:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410484#M32367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is my setup:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]12881[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The full path is to a point feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;D:\GeoFabric\HR_Catchments\HR_Catchments.gdb\HR_Catchments\AHGFNode&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 20:55:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410484#M32367</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-03-20T20:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410485#M32368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I have worked out what the problem is, the selectlayerbylocation doesn't work when the layer coordinate system is different to the dataframe's in that is one is projected and the other is geographic then the layer that is different refuses to be selected.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I started with a fresh mxd it all worked as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this a bug or "as designed"?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 03:59:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410485#M32368</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-03-21T03:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410486#M32369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hmm, and then I do a retest of the theory and it now refuses to work again...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 04:11:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410486#M32369</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-03-21T04:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410487#M32370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was able to reproduce this behavior when the data frame is set to a different coordinate system than the feature class the selection is applied to.&amp;nbsp; I was able to workaround this by going into the Environments &amp;gt; Output Coordinates and changing Output Coordinate System to 'Same as Display'.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 10:02:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410487#M32370</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-03-21T10:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410488#M32371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Looks like the environment setting 'Same as Display' works (even or one layer loaded into a fresh mxd that wasn't working). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After a look through the help files it looks like this isn't something I can set in python code, do you know of a way to set this in code? I can only see the ability to set the projection in code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 21:17:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410488#M32371</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-03-21T21:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410489#M32372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Stephen, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add the following (in bold) to your script.&amp;nbsp; This will be the same as setting the Output Coordinate System to 'Same as Display'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import mapping from arcpy import env&amp;nbsp; mxd = mapping.MapDocument("CURRENT") df = mapping.ListDataFrames(mxd)[0] spatialReference = df.spatialReference&amp;nbsp; env.outputCoordinateSystem = spatialReference&amp;nbsp; # Script arguments Point_Selection = arcpy.GetParameterAsText(0)&amp;nbsp; Polygon_Selection = arcpy.GetParameterAsText(1)&amp;nbsp; # Process: Select Layer By Location arcpy.SelectLayerByLocation_management(Polygon_Selection, "INTERSECT", Point_Selection, "", "NEW_SELECTION")&amp;nbsp; arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 09:44:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410489#M32372</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-03-22T09:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select polygon under feature set point</title>
      <link>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410490#M32373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Works a treat thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 21:43:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-polygon-under-feature-set-point/m-p/410490#M32373</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-03-22T21:43:23Z</dc:date>
    </item>
  </channel>
</rss>

