<?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 SelectLayerByLocation_management fails for unknown reason in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1094984#M45140</link>
    <description>&lt;P&gt;I have an ArcGIS hosted feature layer, and want to make a selection based on a lat/lon. The last line is generating an error:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;RuntimeError&lt;/SPAN&gt;: Object: Error in executing tool)&lt;/PRE&gt;&lt;P&gt;I can't identify what I'm doing wrong. All is in WGS84. Here's the code&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;&lt;BR /&gt;gis = GIS("&lt;A href="https://www.arcgis.com" target="_blank"&gt;https://www.arcgis.com&lt;/A&gt;", "XXXX", "XXXX")&lt;BR /&gt;append_layer_itemid = '33518827e9e24defbacd671bfd26XXXX'&lt;/P&gt;&lt;P&gt;#Grab the layer&lt;BR /&gt;fs_item = gis.content.get(append_layer_itemid)&lt;BR /&gt;fs_layer = fs_item.layers[0]&lt;/P&gt;&lt;P&gt;#make a layer with the points&lt;BR /&gt;arcpy.env.workspace = r"C:\Users\cbent\OneDrive\Documents\ArcGIS\Projects\MyProject\MyProject.gdb"&lt;BR /&gt;arcpy.MakeFeatureLayer_management('points_layer', 'point_layer')&lt;/P&gt;&lt;P&gt;arcpy.SelectLayerByLocation_management(fs_layer,'INTERSECT','point_layer')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's the last line that's failing, any ideas?&lt;/P&gt;&lt;P&gt;Chuck&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Sep 2021 16:50:28 GMT</pubDate>
    <dc:creator>ChuckBenton</dc:creator>
    <dc:date>2021-09-02T16:50:28Z</dc:date>
    <item>
      <title>SelectLayerByLocation_management fails for unknown reason</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1094984#M45140</link>
      <description>&lt;P&gt;I have an ArcGIS hosted feature layer, and want to make a selection based on a lat/lon. The last line is generating an error:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;RuntimeError&lt;/SPAN&gt;: Object: Error in executing tool)&lt;/PRE&gt;&lt;P&gt;I can't identify what I'm doing wrong. All is in WGS84. Here's the code&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;&lt;BR /&gt;gis = GIS("&lt;A href="https://www.arcgis.com" target="_blank"&gt;https://www.arcgis.com&lt;/A&gt;", "XXXX", "XXXX")&lt;BR /&gt;append_layer_itemid = '33518827e9e24defbacd671bfd26XXXX'&lt;/P&gt;&lt;P&gt;#Grab the layer&lt;BR /&gt;fs_item = gis.content.get(append_layer_itemid)&lt;BR /&gt;fs_layer = fs_item.layers[0]&lt;/P&gt;&lt;P&gt;#make a layer with the points&lt;BR /&gt;arcpy.env.workspace = r"C:\Users\cbent\OneDrive\Documents\ArcGIS\Projects\MyProject\MyProject.gdb"&lt;BR /&gt;arcpy.MakeFeatureLayer_management('points_layer', 'point_layer')&lt;/P&gt;&lt;P&gt;arcpy.SelectLayerByLocation_management(fs_layer,'INTERSECT','point_layer')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's the last line that's failing, any ideas?&lt;/P&gt;&lt;P&gt;Chuck&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 16:50:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1094984#M45140</guid>
      <dc:creator>ChuckBenton</dc:creator>
      <dc:date>2021-09-02T16:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: SelectLayerByLocation_management fails for unknown reason</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1095096#M45150</link>
      <description>&lt;P&gt;&lt;SPAN&gt;it may be failing here&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management('points_layer', 'point_layer')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You might want to use arcpy.Exists&amp;nbsp; to confirm the existence prior to select by location.&amp;nbsp; It would also be a good idea to check both layer coordinate systems while you are at it and bail if they differ&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 20:08:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1095096#M45150</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-09-02T20:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: SelectLayerByLocation_management fails for unknown reason</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1096408#M45327</link>
      <description>&lt;P&gt;&amp;nbsp;The online Parcel Layer is in&amp;nbsp;&lt;SPAN&gt;WGS_1984_Web_Mercator_Auxiliary_Sphere (WKID 3857). Earlier I did have the point layer in a different WGS 1984 WKID, which has been corrected. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I now print the point_layer WIKI and bail if it isn't 3857. I also confirm it exists.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Still seeing the same error:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;RuntimeError&lt;/SPAN&gt;: Object: Error in executing tool&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;. Any suggestions?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 14:54:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1096408#M45327</guid>
      <dc:creator>ChuckBenton</dc:creator>
      <dc:date>2021-09-08T14:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: SelectLayerByLocation_management fails for unknown reason</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1098144#M45555</link>
      <description>&lt;P&gt;Changing fs_layer in&amp;nbsp;&lt;SPAN&gt;arcpy.SelectLayerByLocation_management(fs_layer,'INTERSECT','point_layer')&lt;/SPAN&gt; to&amp;nbsp;"&lt;A href="https://services8.arcgis.com/2G8bTpCps4vdRut5/arcgis/rest/services/ParcelAtlas_V2_4/FeatureServer/0" target="_blank"&gt;https://services8.arcgis.com/2G8bTpCps4vdRut5/arcgis/rest/services/ParcelAtlas_V2_4/FeatureServer/0&lt;/A&gt;" fixed the issue. Basically had to use the service URL directly.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Sep 2021 16:48:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/selectlayerbylocation-management-fails-for-unknown/m-p/1098144#M45555</guid>
      <dc:creator>ChuckBenton</dc:creator>
      <dc:date>2021-09-14T16:48:55Z</dc:date>
    </item>
  </channel>
</rss>

