AnsweredAssumed Answered

Reference the Featureset for a geoprocessing task

Question asked by ionarawilson on Oct 3, 2013
Latest reply on Oct 17, 2013 by ionarawilson
I am calling a geoprocessing service in a web app. The geoprocessing service has one parameter. 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!

   var stewardship = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/MyMapService2/FeatureServer/2",{           mode: FeatureLayer.MODE_ONDEMAND,            outFields: ['*']         });          map.addLayers([ActivityArea,ActivityPoint,stewardship]);                          function initEditor(evt) {             var templateLayers = arrayUtils.map(evt.layers, function(result){             return result.layer;               });           var templatePicker = new TemplatePicker({             featureLayers: templateLayers,             grouping: true,             rows: "auto",             columns: 3           }, "templateDiv");           templatePicker.startup();            var layers = arrayUtils.map(evt.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,                 Editor.CREATE_TOOL_CIRCLE,                 Editor.CREATE_TOOL_TRIANGLE,                 Editor.CREATE_TOOL_RECTANGLE               ]             },             toolbarOptions: {               reshapeVisible: true             }                   };            var params = {settings: settings};               var myEditor = new Editor(params,'editorDiv');           //define snapping options           var symbol = new SimpleMarkerSymbol(             SimpleMarkerSymbol.STYLE_CROSS,              15,              new SimpleLineSymbol(               SimpleLineSymbol.STYLE_SOLID,                new Color([255, 0, 0, 0.5]),                5             ),              null           );           map.enableSnapping({             snapPointSymbol: symbol,             tolerance: 20,             snapKey: keys.ALT           });                myEditor.startup();         }            gp = new esri.tasks.Geoprocessor("http://tfsgis-iisd01:6080/arcgis/rest/directories/arcgisoutput/CalcFeaturesStewardshipNoParam4_GPServer/CalcFeaturesStewardshipNoParam4")   gp.setOutSpatialReference({wkid:102100});           on(dom.byId("button"),"click", function() {           alert("TEST")      //    gp.submitJob(params, completeCallback , statusCallback,function(error){ //          alert(error);          });    


The Python

import os, sys, arcpy arcpy.env.workspace = "Database Connections\\sars.sde\\"  value = arcpy.GetParameterAsText(0)   Input_Polygons = "Stewardship"   Input_Polygons_Layer = "SamplePoints_Layer"  arcpy.MakeFeatureLayer_management(Input_Polygons, Input_Polygons_Layer)  with arcpy.da.UpdateCursor(Input_Points_Layer, ("City")) as rows:                  for row in rows:             row[0] = value                         rows.updateRow(row) 

Outcomes