Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am calling a geoprocessing service in a web app. The geoprocessing service has one parameter (a feature set). But I am not sure how to find the parameter in the javascript code to send it to the geoprocessing since I am using an editor widget to first create the polygon and then run the geoprocessing service. Can you guys take a look at my code and tell me how I reference a feature set from the editor widget results? Thank you!

], function(
    Map, BasemapGallery, arcgisUtils, Edit, 
    ArcGISTiledMapServiceLayer, FeatureLayer,
    Query, QueryTask,
    SimpleMarkerSymbol, SimpleLineSymbol, 
    Editor, TemplatePicker, 
    esriConfig, jsapiBundle,
    arrayUtils, parser, keys,  

    borderContainer, contentPane, titlePane,
    dom, on
  ) {

    // snapping is enabled for this sample - change the tooltip to reflect this
    jsapiBundle.toolbars.draw.start = jsapiBundle.toolbars.draw.start +  "<br>Press <b>ALT</b> to enable snapping";

    // refer to "Using the Proxy Page" for more information: = "/proxy";    

    esriConfig.defaults.geometryService = new esri.tasks.GeometryService("http://tfsgis-iisd01:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer");

    map = new Map("map", { 
      basemap: "hybrid",

      center: [-98.57, 30.98],
      zoom: 6,
      slider: true 

    map.on("layers-add-result", initEditor);

    var ActivityArea = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/MyMapService2/FeatureServer/1",{
      mode: FeatureLayer.MODE_ONDEMAND, 
      outFields: ['*']

    var ActivityPoint = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/MyMapService2/FeatureServer/0",{
      mode: FeatureLayer.MODE_ONDEMAND, 
      outFields: ['*']

    var stewardship = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/MyMapService2/FeatureServer/2",{
      mode: FeatureLayer.MODE_ONDEMAND, 
      outFields: ['*']


    function initEditor(evt) {

      var templateLayers =, function(result){
        return result.layer;


      var templatePicker = new TemplatePicker({
        featureLayers: templateLayers,
        grouping: true,
        rows: "auto",
        columns: 3
      }, "templateDiv");

      var layers =, function(result) {
        return { featureLayer: result.layer };

      var settings = {
        map: map,
        templatePicker: templatePicker,
        layerInfos: layers,
        toolbarVisible: true,
        createOptions: {
          polylineDrawTools:[ Editor.CREATE_TOOL_FREEHAND_POLYLINE ],
          polygonDrawTools: [ Editor.CREATE_TOOL_FREEHAND_POLYGON,
        toolbarOptions: {
          reshapeVisible: true


      var params = {settings: settings};    
      var myEditor = new Editor(params,'editorDiv');
      //define snapping options
      var symbol = new SimpleMarkerSymbol(
        new SimpleLineSymbol(
          new Color([255, 0, 0, 0.5]), 
        snapPointSymbol: symbol,
        tolerance: 20,
        snapKey: keys.ALT



     on(dom.byId("button"),"click", function() {
    gp = new esri.tasks.Geoprocessor("http://tfsgis-iisd01:6080/arcgis/rest/services/CalcFeaturesStewardshipOneParameter3/GPServer/CalcFeaturesStewardshipOneParameter")
    //gp.outSpatialReference = map.spatialReference

    var features= [];

    var selectGraphics = featureLayer.getSelectedFeatures();

    var featureSet = new esri.tasks.FeatureSet();

    featureSet.features = features;

    var params = {Stewardship:featureSet}

    gp.submitJob(params, completeCallback , statusCallback)


    function completeCallback(jobInfo){


  function statusCallback(jobInfo) {
    var status = jobInfo.jobStatus;
    if(status === "esriJobFailed"){

    else if (status === "esriJobSucceeded"){
share|improve this question
This isn't at all easy to follow. The code you've included looks like a partial snapshot of a much larger code base, and the intent is far from clear. Can you consider trying to make a smaller sample that shows the particular issue you need help with? –  BradHards Oct 8 '13 at 3:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.