marija.smoljanicgdi-net-esridist

Geoprocessing problem - javascript + REST

Discussion created by marija.smoljanicgdi-net-esridist Employee on Nov 18, 2011
Latest reply on Nov 23, 2011 by marija.smoljanicgdi-net-esridist
Hello,

I have a problem consuming a geoprocessing service with Extract Data task using javascript API and REST on ArcGIS Server 10.

When consumed from a web app the service returns feature classes with no data. However, when consumed from ArcMap (also as a service) everything works fine.

The task always finishes successfully.

I modified the code from the javascript API samples page, and here it is:

        var clipLayers = [];
        if(dijit.byId('layer1').checked){clipLayers.push('TACKE_EM');}
        if(dijit.byId('layer2').checked){clipLayers.push('LINIJE_EM');}
        if(dijit.byId('layer3').checked){clipLayers.push('POVRSINE_EM');}
        if(clipLayers.length === 0 || map.graphics.graphics.length === 0){
          alert('Select layers to extract and area of interest');
          return;
        }
        var features =[];
        features.push(map.graphics.graphics[0]);
        var featureSet = new esri.tasks.FeatureSet();
        featureSet.features = features;

     var rasterFormat = "ESRI GRID - GRID";
     var spatialReference = "MGI Balkans 7";

        var params = {"Layers_to_Clip":clipLayers,
          "Area_of_Interest": featureSet,
          "Feature_Format": dijit.byId('formatBox').value,
          "Raster_Format" : rasterFormat,
          "Spatial_Reference" : spatialReference
        };
       
        gp.submitJob(params, completeCallback , statusCallback,function(error){
          alert(error);
        });

What am I doing wrong?
If you need additional info, please ask.

Thanks in advance.

Outcomes