softwavegis

Problems using polygon from feature layer as input to a geoprocessing service

Discussion created by softwavegis on Jul 14, 2011
I'm getting a "unable to complete operation" error when submitting the job.  I am using a very simple GP Service having followed the Buffer Points GP Service tutorial at http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#/GP_service_step_by_step_Buffer_points/00930000003n000000/

The only difference from the tutorial s that I am buffering a polygon from a feature layer instead of a point clicked by the user.  Here is my code:
function useGPTool(evt) {

   var gp = new esri.tasks.Geoprocessor("http://gis2/ArcGIS/rest/services/test/test/GPServe/TestBuffer");
   gp.setOutSpatialReference({wkid:3875});

   //get feature from polyLayer to pass into gp tool
   var query = new esri.tasks.Query();
   query.where = "OBJECTID = 1";
   query.outFields = ["*"];

   polyLayer.queryFeatures(query, function (features) {
       var featureList = features.features;

       if (featureList.length > 0) {

         alert("Feature(s) found.");
         var featureSet = new esri.tasks.FeatureSet();
         featureSet.features = featureList;
         var params = new Object();
         params.AOI = featureSet;
         params.Distance = 2000;

         gp.submitJob(params, completeCallback , statusCallback,function(error){
            alert(error);
         });

       } else {
         alert("No features found.");
       }
   }, displayMsg);   

}

Here is the Rest service description:

      Parameter: AOIBuff
            Data Type: GPFeatureRecordSetLayer
            Display Name: AOIBuff
            Direction: esriGPParameterDirectionOutput
            Default Value:
                  Geometry Type: esriGeometryPolygon
                  Spatial Reference: 102100 (3857)
                  Fields:
                      # OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID)
                      # Shape (Type: esriFieldTypeGeometry, Alias: Shape)
                      # AREA (Type: esriFieldTypeSingle, Alias: AREA)
                      # PERIMETER (Type: esriFieldTypeSingle, Alias: PERIMETER)
                      # BRGD_BC_ (Type: esriFieldTypeInteger, Alias: BRGD_BC_)
                      # BRGD_BC_ID (Type: esriFieldTypeInteger, Alias: BRGD_BC_ID)
                      # BCCD_CD (Type: esriFieldTypeSmallInteger, Alias: BCCD_CD)
                      # BCCD_POP (Type: esriFieldTypeInteger, Alias: BCCD_POP)
                      # BCCD_DWL (Type: esriFieldTypeInteger, Alias: BCCD_DWL)
                      # NAME (Type: esriFieldTypeString, Alias: NAME)
                      # FCODE (Type: esriFieldTypeString, Alias: FCODE)
                      # Shape_Leng (Type: esriFieldTypeDouble, Alias: Shape_Leng)
                      # BUFF_DIST (Type: esriFieldTypeDouble, Alias: BUFF_DIST)
                      # Shape_Length (Type: esriFieldTypeDouble, Alias: Shape_Length)
                      # Shape_Area (Type: esriFieldTypeDouble, Alias: Shape_Area)
            Parameter Type: esriGPParameterTypeRequired
            Category:

      Parameter: AOI
            Data Type: GPFeatureRecordSetLayer
            Display Name: AOI
            Direction: esriGPParameterDirectionInput
            Default Value:
                  Geometry Type: esriGeometryPolygon
                  Spatial Reference: 102100 (3857)
                  Fields:
                      # OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID)
                      # Shape (Type: esriFieldTypeGeometry, Alias: Shape)
                      # AREA (Type: esriFieldTypeSingle, Alias: AREA)
                      # PERIMETER (Type: esriFieldTypeSingle, Alias: PERIMETER)
                      # BRGD_BC_ (Type: esriFieldTypeInteger, Alias: BRGD_BC_)
                      # BRGD_BC_ID (Type: esriFieldTypeInteger, Alias: BRGD_BC_ID)
                      # BCCD_CD (Type: esriFieldTypeSmallInteger, Alias: BCCD_CD)
                      # BCCD_POP (Type: esriFieldTypeInteger, Alias: BCCD_POP)
                      # BCCD_DWL (Type: esriFieldTypeInteger, Alias: BCCD_DWL)
                      # NAME (Type: esriFieldTypeString, Alias: NAME)
                      # FCODE (Type: esriFieldTypeString, Alias: FCODE)
                      # Shape_Leng (Type: esriFieldTypeDouble, Alias: Shape_Leng)
                      # Shape_Length (Type: esriFieldTypeDouble, Alias: Shape_Length)
                      # Shape_Area (Type: esriFieldTypeDouble, Alias: Shape_Area)
            Parameter Type: esriGPParameterTypeRequired
            Category:

      Parameter: Distance
            Data Type: GPLinearUnit
            Display Name: Distance
            Direction: esriGPParameterDirectionInput
            Default Value: 1000 esriMeters
            Parameter Type: esriGPParameterTypeRequired
            Category:

Supported Operations:   Submit Job

Supported Interfaces:   REST


I have not found any examples where the input polygon is from a map layer.  Does anyone have any ideas?

Thanks

Outcomes