Select to view content in your preferred language

API 4.22 JobInfo fetchResultData() gives result with correct dataType but result.value.features is an empty array

2234
3
Jump to solution
02-08-2022 04:29 AM
MichaelLev
Frequent Contributor

In 4.22 "esri/tasks/Geoprocessor" is depricated 
and "esri/rest/geoprocessor" is recommended instaead, so I used it.

geoprocessor.submitJob(gpServiceUrl, gpParams)
    .then(function (jobInfo)) {
        jobInfo.waitForJobCompletion().then(() => {
            jobInfo.fetchResultData("pointFC")
                .then(function (result) {
                    if (result.dataType == "feature-record-set-layer") {
                        let featureSet = result.value;
                        console.log(`Points: ${featureSet.features.length}`);// gives "0"
                    }
                 });
             });
         });

0 Kudos
1 Solution

Accepted Solutions
MichaelLev
Frequent Contributor

Dear @ReneRubalcava ,


By help of Israeli ESRI representative (Systematics company) the problem has been found.

It turns out that if the tool outputs the MapImage layer, then the output of the 4 layers themselves is actually the metadata only, not the real data. So, I modified the geoprocessing tool to not output the MapImage layer, but only the 4 layers, and it is OK.

A comment: Maybe it makes sense if ESRI will modify the geoprocessing tool so that the output of the layers themselves will NOT be spoiled when MapImage layer is also being output.?

Michael

View solution in original post

0 Kudos
3 Replies
ReneRubalcava
Honored Contributor

Do you have a sample GP service to test against? I was able to test this against our HotSpot GP Service and get the features. https://codepen.io/odoe/pen/ExbWxRR?editors=1000

Another way to test is against the GeoprocessorTask in 4.19, that was before we updated to the rest modules. It would be odd if it was different though, that underlying parsing logic wasn't changed, so curious to see the result of that.

MichaelLev
Frequent Contributor

Dear @ReneRubalcava , thank you for replying and for modifying ESRI's example Geoprocessing - hotspot analysis to extract the layers themselves. I tested and it works.

I did as you said - besides rest geoprocessor service, I tested also the 4.19 Geoprocessor, but both gave identical results: Our gp tool can return OK the MapImageLayer, but not the layers themselves - result.value.features is an empty array, and result.value.geometryType is null.

The only difference I can think of is that we work on 3D scenes. But it's hard to imagine this is the problem. Maybe you can show me an working example on 3D scene?

IF geoprocessor gives the layers themselves also on 3D scenes, then the problem is either with my gp tool or with my code.

MY gp tool converts CAD files (*.dwg) to SHP, containing points,lines,polygons/annotation layers. ArcGisPro was used to create a model containing Python script which used esri "CAD to Geodatabase" tool. I attach a screenshot of the model, and 2 CAD files.

If, as you wrote, one or more of the next things will help you locate the problem:
     - url of our gp service,
     - the python script,
     - url of minimal WAB web app with custom widget containing my code,
     - zip of my WAB web app code, containing my custome widget for converting Cad2SHP
Then I request you to instruct me how to send to you by private means (email?)

 

0 Kudos
MichaelLev
Frequent Contributor

Dear @ReneRubalcava ,


By help of Israeli ESRI representative (Systematics company) the problem has been found.

It turns out that if the tool outputs the MapImage layer, then the output of the 4 layers themselves is actually the metadata only, not the real data. So, I modified the geoprocessing tool to not output the MapImage layer, but only the 4 layers, and it is OK.

A comment: Maybe it makes sense if ESRI will modify the geoprocessing tool so that the output of the layers themselves will NOT be spoiled when MapImage layer is also being output.?

Michael

0 Kudos