ERROR 000735: analysisLayer: Value is required arcgis.js:62 ERROR 000735: nearLayer: Value is required arcgis.js:62 Failed.
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);
Solved! Go to Solution.
var _params = { "analysisLayer": JSON.stringify({ "layerDefinition": { "geometryType": "esriGeometryPoint", "fields": [{ "name": "Id", "type": "esriFieldTypeOID", "alias": "Id" }] }, "featureSet": { "geometryType": "esriGeometryPoint", "spatialReference": { "wkid": 4326 }, "features": [{ "geometry": { "x": -95.00, "y": 28.00 }, "attributes": { "Id": 1 } }] } }), "nearLayer": JSON.stringify({ "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" }
http://services.arcgis.com/OfH668nDRN7tbJh0/arcgis/rest/services/Markets%20close%20to%20parks/FeatureServer/0/query?where=1%3D1&returnGeometry=true&outFields=OBJECTID&outSR=102100&f=json
{ "url": "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/1/query?where=1%3D1&outFields=Name,RouteName&f=json" }
var gp = new Geoprocessor("http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/FindNearest"); var _params = { "analysisLayer": { "layerDefinition": { "geometryType": "esriGeometryPoint", "fields": [ { "name": "Id", "type": "esriFieldTypeOID", "alias": "Id" } ]}, "featureSet": { "geometryType": "esriGeometryPoint", "spatialReference": { "wkid": 4326 }, "features": [ { "geometry": { "x": -95.00, "y": 28.00 }, "attributes": { "Id": 1 } } ]} }, // { // "url": "https://services1.arcgis.com/fcrLbZIfZI20fNqr/arcgis/rest/services/rig_subset_4326/FeatureServer/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);
var _params = { "analysisLayer": JSON.stringify({ "layerDefinition": { "geometryType": "esriGeometryPoint", "fields": [{ "name": "Id", "type": "esriFieldTypeOID", "alias": "Id" }] }, "featureSet": { "geometryType": "esriGeometryPoint", "spatialReference": { "wkid": 4326 }, "features": [{ "geometry": { "x": -95.00, "y": 28.00 }, "attributes": { "Id": 1 } }] } }), "nearLayer": JSON.stringify({ "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); }); function completeCallback(jobInfo) { var url = "http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/FindNearest/jobs/" + jobInfo.jobId + "/results/nearestLayer"; var token = esri.id.credentials[1].token; console.log(token); var nearRigs = esriRequest({ url: url, //will be unable to access results if left out: content: { f: "json", token: token} }, { disableIdentityLookup: true }); nearRigs.then(function (data) { console.log("Data: ", data); // print the data to browser's console }, function (error) { console.log("Error: ", error.message); }); }
content: { f: "json", token: token}
function completeCallback(jobInfo) { var url = "http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/FindNearest/jobs/" + jobInfo.jobId + "/results/nearestLayer?f=json"; var token = esri.id.credentials[1].token; console.log(token); var nearRigs = esriRequest({ url: url //content: { f: "json", token: token} }); nearRigs.then(function (data) { console.log("Data: ", data); // print the data to browser's console }, function (error) { console.log("Error: ", error.message); }); }
Job Details: Model
Check Job Details:
Return Messages: True False
View In: Google Earth
Job ID: j4b4f0182872145a093f614736caf1486
Job Status: esriJobFailed
Job Messages:
esriJobMessageTypeInformative: Submitted.
esriJobMessageTypeInformative: Executing...
esriJobMessageTypeInformative:
esriJobMessageTypeWarning: WARNING 000725: KCC_InputFeature_GenerateNea8: Dataset C:\arcgisserver\python\FindFeatures2\Features.gdb\KCC_InputFeature_GenerateNea8 already exists.
esriJobMessageTypeError: The value does not exist. The value does not exist. The value does not exist. ERROR 000732: Near Features: Dataset GuidedWalks;KCC_PROMOTED_ROUTEZ_2;KCC_COUNTRYPARKZ does not exist or is not supported ERROR 000732: Join Features: Dataset KCC_COUNTRYPARKZ does not exist or is not supported ERROR 000732: Join Features: Dataset KCC_PROMOTED_ROUTEZ_2 does not exist or is not supported ERROR 000732: Join Features: Dataset GuidedWalks does not exist or is not supported WARNING 000725: Output Dataset: Dataset C:\arcgisserver\python\FindFeatures2\Features.gdb\KCC_InputFeature_GenerateNea8 already exists.
esriJobMessageTypeError: Failed.
Ganesh,
Sure: http://jsfiddle.net/geo_james/uDX9a/1/
A free developer AGOL account works fine. I was considering my own GP model if I couldn't get this to work but we eventually cracked it. Thanks to Derek.
Cheers,
James