<?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 FindNearest failing even though I can get a credit estimate (Python API, not the REST API) in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/findnearest-failing-even-though-i-can-get-a-credit/m-p/1528289#M10471</link>
    <description>&lt;P&gt;I am trying to use the FindNearest analysis module (&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.analysis.html#find-nearest" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/api-reference/arcgis.features.analysis.html#find-nearest&lt;/A&gt;) to find a line that's closest to each point and get the ID of that line segment. My code is pretty simple:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#import modules
from arcgis.gis import GIS
import arcgis.features.analysis
gis = GIS("home")

#get AGOL items as instances of FeatureLayers
##point layer
survey_pt = itemId
survey_layer=(gis.content.get(survey_pt)).layers[0]
## line layer
sidewalks = itemId
sdwlk_layer=(gis.content.get(sidewalks)).layers[0]

#run FindNearest
arcgis.features.analysis.find_nearest(survey_layer, sdwlk_layer,
measurement_type='StraightLine', max_count=10, output_name='Nearest_Test')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It returns the following error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;{"messageCode": "AO_100030", "message": "FindNearest failed."}
Failed to execute (FindNearest).
Failed.&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried the use_proximity version of FindNearest and got the same error. Is there something obvious I'm doing? When I add `estimate=True` to the parameters, I can get a return number of "47.155" and I definitely have enough credits for that. It seems like since I can get an estimate, I am successfully reaching the server but it doesn't seem to like my parameters when I actually try to run the processing job.&lt;/P&gt;&lt;P&gt;Please advise - any information is appreciated!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Aug 2024 23:48:36 GMT</pubDate>
    <dc:creator>MaryGraceMcClellan</dc:creator>
    <dc:date>2024-08-27T23:48:36Z</dc:date>
    <item>
      <title>FindNearest failing even though I can get a credit estimate (Python API, not the REST API)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/findnearest-failing-even-though-i-can-get-a-credit/m-p/1528289#M10471</link>
      <description>&lt;P&gt;I am trying to use the FindNearest analysis module (&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.analysis.html#find-nearest" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/api-reference/arcgis.features.analysis.html#find-nearest&lt;/A&gt;) to find a line that's closest to each point and get the ID of that line segment. My code is pretty simple:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#import modules
from arcgis.gis import GIS
import arcgis.features.analysis
gis = GIS("home")

#get AGOL items as instances of FeatureLayers
##point layer
survey_pt = itemId
survey_layer=(gis.content.get(survey_pt)).layers[0]
## line layer
sidewalks = itemId
sdwlk_layer=(gis.content.get(sidewalks)).layers[0]

#run FindNearest
arcgis.features.analysis.find_nearest(survey_layer, sdwlk_layer,
measurement_type='StraightLine', max_count=10, output_name='Nearest_Test')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It returns the following error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;{"messageCode": "AO_100030", "message": "FindNearest failed."}
Failed to execute (FindNearest).
Failed.&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried the use_proximity version of FindNearest and got the same error. Is there something obvious I'm doing? When I add `estimate=True` to the parameters, I can get a return number of "47.155" and I definitely have enough credits for that. It seems like since I can get an estimate, I am successfully reaching the server but it doesn't seem to like my parameters when I actually try to run the processing job.&lt;/P&gt;&lt;P&gt;Please advise - any information is appreciated!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 23:48:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/findnearest-failing-even-though-i-can-get-a-credit/m-p/1528289#M10471</guid>
      <dc:creator>MaryGraceMcClellan</dc:creator>
      <dc:date>2024-08-27T23:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: FindNearest failing even though I can get a credit estimate (Python API, not the REST API)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/findnearest-failing-even-though-i-can-get-a-credit/m-p/1528362#M10472</link>
      <description>&lt;P&gt;moving to ...&amp;nbsp;arcgis-api-for-python-questions&lt;/P&gt;&lt;P&gt;for a better target audience, since it is more an api question than a python issue&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 01:46:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/findnearest-failing-even-though-i-can-get-a-credit/m-p/1528362#M10472</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-08-28T01:46:08Z</dc:date>
    </item>
  </channel>
</rss>

