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!
moving to ... arcgis-api-for-python-questions
for a better target audience, since it is more an api question than a python issue