Select to view content in your preferred language

FindNearest failing even though I can get a credit estimate (Python API, not the REST API)

458
1
08-27-2024 04:43 PM
MaryGraceMcClellan
Regular Contributor

I am trying to use the FindNearest analysis module (https://developers.arcgis.com/python/api-reference/arcgis.features.analysis.html#find-nearest) to find a line that's closest to each point and get the ID of that line segment. My code is pretty simple: 

 

 

 

#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')

 

 

  

It returns the following error: 

{"messageCode": "AO_100030", "message": "FindNearest failed."}
Failed to execute (FindNearest).
Failed.

 

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.

Please advise - any information is appreciated!  

 

 

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

moving to ... arcgis-api-for-python-questions

for a better target audience, since it is more an api question than a python issue


... sort of retired...