0

I want to download the feature layer which I input as a string parameter to my GP service. When I run the script I got the following errors.

First time when I run it:

job-submitted  gp_service_run2.php:110
job-failed

When I reload the page:

MapView.js:381 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as  'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
(anonymous) @ MapView.js:381 set  @ MapView.js:380 m.updateDependencies @ MapView.js:436 updateDependencies @ MapView.js:432 onResume @ MapView.js:349
b.resume @ MapView.js:351 (anonymous) @ MapView.js:362 m @ dojo.js:1079
p.onInstall @ MapView.js:362 b @ MapView.js:432 m.installHandlers @ MapView.js:433 g._connect @ MapView.js:342 (anonymous) @ MapView.js:341
(anonymous) @ dojo.js:1077 a @ dojo.js:363 m @ dojo.js:364 p @ dojo.js:370
(anonymous) @ dojo.js:374 gp_service_run2.php:110 

job-submitted gp_service_run2.php:110 
job-executinggp_service_run2.php:110 
job-failed

In all other occasions when reloading same error and:

job-submitted gp_service_run2.php:110
job-failed

Where I have made the mistake in my code?

<script>
    require([
        "esri/Map",
        "esri/views/MapView",
        "esri/layers/FeatureLayer",
        "esri/tasks/Geoprocessor",
        //"esri/tasks/FeatureSet",
        "esri/views/MapView",
        "esri/layers/support/ImageParameters"
      ],
      function(
        Map,MapView, FeatureLayer,Geoprocessor,ImageParameters,FeatureSet ) {
        var gpUrl="http://www.xxxxxxxxxxxxxxxxxxxxxxx/GPServer/Script";
        var map = new Map({
          basemap: "gray"
        });

        var view = new MapView({
          container: "viewDiv",
          map: map,
          center: [80.9,7.8],
          zoom: 8
        });
        var featureLayer2 = new FeatureLayer({
             url:"http://www.xxxxxxxxxxxxxxxxxxxxxxxxxxxx/FeatureServer",
          outFields:["*"],
            popupTemplate:{
          title:"Parcel Deatils",
         content:"Lot No:"+"{sht_pg_id}"
          }
            });

        map.add(featureLayer2);
        var gp =new Geoprocessor(gpUrl);
        //gp.outSpatialReference = map.spatialReference;
       gp.outSpatialReference = {
        wkid: 5235         
       };

        var params = {
         "sheet": featureLayer2,
            "Plan_No":"28006103S001" 
             };
        gp.submitJob(params).then(drawResultData, errBack, progTest);

         function drawResultData(result) {
         //var resultLayer = gp.getResultData(result.jobId);
          //map.add(resultLayer);
          //document.getElementById("demo").innerHTML = ""+result.jobId;

          if (result.jobStatus == "job-succeeded") {      
                    gp.getResultData(result.jobId,"save",downloadFile);             
                      }     };

        function progTest(value) {
          //message.innerText = "Job status: " + "'" + value.jobStatus + "'";
          console.log(value.jobStatus);
        }
        function errBack(error) {
          //message.innerText = "";
          console.log("gp error: ", error);
        }

        });

  </script>
  • 1
    you'll need to add more information. You've provided a snippet of JS which from a quick scan looks ok, but you're referencing PHP errors. How are you running the code? If you run the GP Service from ArcMap or Pro, does it work there? (that'll explain if the error is in the service or the JS/PHP code) – KHibma Apr 5 at 12:39
  • When I connect to GP server through arcmap,it is working and output feature layer automatically add to the window.(i am running this php file using localhost.) – suda Apr 6 at 6:08
  • Your problem is probably in the drawResultData function. You're calling getResultData twice. 1) you're calling it probably before the submitJob == finished and 2) you're calling it again, after succeeded, but looking more like filedownload, than featurelayer draw. You'll need to go back and re-work your JS code. – KHibma Apr 8 at 12:34
  • Thank you for your valuable idea.i have edited as you said above. Actually, I need to download the relevant feature layer rather than adding it into the map. The edited code is mentioned above. I think this is the code you expected. But still, this is not working. But i forget very import thing tell you. That is, when i run the programme( mentioned above before) first time on the day it said the job-succeeded.next time when I reload it, it gave the above errors. – suda Apr 9 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.