esri/rest/geoprocessor - jobInfo.fetchResultData(<parameter name>) gives empty FeatureSet

326
1
Jump to solution
01-31-2022 12:30 AM
MichaelLev
Occasional Contributor III

I use WebAppBuilder 2.22 to develop 3D web apps with custom widgets (esri js API 4.22) for our portal.

I use python peoprocessing tool and the 'esri/rest/geoprocessor' service to create in the portal a shape file that contains points, polygons and polylines feature layers. 

I succeeded to cause the server to display the shapefile in the web app (see in the code),
b
ut for some reasons this is not what I need...
What I really need is to retrieve the feature layers themselves (the points layer, the polygon layer, the polyline layer etc.) and insert them into the scene by my code.

But, "jobInfo.fetchResultData" gives somehoe an empty featureset for all the shapefile layers...
I need help to fix this. 

The skeleton of my code is:

geoprocessor.submitJob(gpUrl, gpParams)
    .then((jobInfo) => {
        jobInfo.waitForJobCompletion().then((jobInfo2) => {
             //this works to display the shapefle on the 3D scene, .
             //But for some reasons this is not what I need...
             jobInfo.fetchResultMapImageLayer(jobInfo.jobId)
                 .then(function (shapefile) {
                       sceneView.map.add(shapefile);
                 });
             //This is what I need... to get the layers themselves
             //I repeat this for points and for polylines
             jobInfo2.fetchResultData("polygonFC")
.                   .then(function (result) {
                             if (result.dataType == "feature-record-set-layer") {
                                      let featureSet = result.value;
                                      //but here, featureSet is an empty array...
                             }
                      });
                        

0 Kudos
1 Solution

Accepted Solutions
MichaelLev
Occasional Contributor III
0 Kudos
1 Reply
MichaelLev
Occasional Contributor III
0 Kudos