Select to view content in your preferred language

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

901
1
07-14-2011 08:47 AM
S_Ector
Emerging Contributor
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_st...

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
0 Kudos
1 Reply
SimonWebster
Regular Contributor

Did you ever get this solved? 

8 years on and there's still not an example in sight. 

0 Kudos