1

I want to pass a feature service as an input(Input parameter type -GPFeatureRecordSetLayer) to a geoprocessing service. can anyone tell me a sample code? I read all the relevant questions available, but I didn't find an answer in which feature service is used as an input.

4
  • 1
    As per the Tour there should be only one question asked per question.
    – PolyGeo
    Commented Mar 26, 2019 at 11:38
  • Are you essentially asking how do I pass a feature service as input to a geoprocessing service?
    – KHibma
    Commented Mar 26, 2019 at 17:18
  • Yes.you are correct. Commented Mar 27, 2019 at 0:26
  • To-PolyGeo-I have edited my question Commented Mar 27, 2019 at 4:05

1 Answer 1

0

You can find an example of this in the 3rd demo of the ZIP file from my presentation Creating Geoprocessing Services UC2014.

While this presentation is 5 years old and the MapServiceIn_FSDraw.html file references the 3.8 JS API, the patterns remain the same for the newer APIS.

Here's a cut/paste of some relevant code:

var inputLayerUrl = "http://xxxx.arcgis.com/xxxxx/arcgis/rest/services/Service/FeatureServer/0";

var inputLayer = new esri.layers.FeatureLayer(inputLayerUrl,{
      mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
      outFields: ["reportedNumber"],
      opacity:.50
}); 

map.addLayer(inputLayer);

//use the map extent to select features
var selectQuery = new Query();          
selectQuery.geometry = map.extent;
inputLayer.selectFeatures(selectQuery, FeatureLayer.SELECTION_NEW);
//"Input_Features" is the name of the input parameter
params.Input_features = inputLayer;     

//Task (geoprocessor is assumed to be already setup)        
task.submitJob(params, taskComplete, taskStatus, taskError); 
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.