Hello all,I've seen similar questions to this but nothing with my specific symptoms so I've started a new thread. I'm trying to use the FindNearest Spatial Analysis Service. I have an AGOL org account, and am using a private webmap which requires me to login.https://developers.arcgis.com/rest/analysis/api-reference/find-nearest.htmhttps://developers.arcgis.com/javascript/jsapi/geoprocessor-amd.html#submitjobThrough a combination of the above resources I've put together some code to submit a job. My job fails with the following errors relating to my input params...ERROR 000735: analysisLayer: Value is required arcgis.js:62 ERROR 000735: nearLayer: Value is required arcgis.js:62 Failed.
What am I doing wrong? var gp = new Geoprocessor("http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/FindNearest"); var _params = { "analysisLayer": { "url": "https://services1.arcgis.com/fcrLbZIfZI20fNqr/arcgis/rest/services/rig_subset_4326/FeatureServer/0" //"url": "http://10.4.164.20:6080/arcgis/rest/services/RigPlanner/RigPlanner_server/MapServer/0" //"filter" : "filter" }, "NearLayer": { "layerDefinition": { "geometryType": "esriGeometryPoint", "fields": [ { "name": "Id", "type": "esriFieldTypeOID", "alias": "Id" } ]}, "featureSet": { "geometryType": "esriGeometryPoint", "spatialReference": { "wkid": 4326 }, "features": [ { "geometry": { "x": -94.00, "y": 28.00 }, "attributes": { "Id": 1 } } ]} }, "maxCount": 10, "measurementType": "StraightLine", //"searchCutoff": 44, //"searchCutoffUnits": "Kilometers" "f": "json" } gp.submitJob(_params, completeCallback, statusCallback, errorCallback);
Also, how would I get the required authentication if I make my webmap and feature service public? Portal class?Thanks,James