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.

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

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"],


//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); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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