AnsweredAssumed Answered

Mosaic Raster Identify Task Timeout Issue

Question asked by LeviCecil on Aug 17, 2017

I have a dynamic map service layer that contains a time enabled mosaic raster. I set up an identify task to grab the pixel values from the mosaic. I set a three second timeout to close the popup after it displays the result. The issue is, sometimes when I click an area were the pixel value should be around 0%, I'll get a result like 86%. This doesn't happen every time, but it shouldn't happen at all. I'm wondering if the identify task is getting messed up when I click and then click again before the three second timeout? When I do this, the popup will come up (with the wrong percentage) for a split second and disappear. Here is the identify portion of my script. 

 

var identifyTask, identifyParams;
          
          map.on("load", mapReady);
          
          function mapReady () {
          map.on("click", executeIdentifyTask);
            map.infoWindow.clearFeatures();
         
          identifyTask = new IdentifyTask(eclipseURL);
          identifyParams = new IdentifyParameters();
          identifyParams.tolerance = 1;
          identifyParams.returnGeometry = true;
          identifyParams.layerIds = [7];
          identifyParams.width = map.width;
          identifyParams.height = map.height;
        }

        function executeIdentifyTask (event) {
           
          identifyParams.geometry = event.mapPoint;
          identifyParams.mapExtent = map.extent;

           var deferred = identifyTask
            .execute(identifyParams);
            deferred.addCallback(function (response) {

              return arrayUtils.map(response, function (result) {
                var feature = result.feature;
                var layerName = result.layerName;
                              
                              var value = feature.attributes['Pixel Value'];
                              
                                   iTemplate = new InfoTemplate(layerName,
                                   "Cloud Cover: " + value + " %");
                                   feature.setInfoTemplate(iTemplate);
                     
                return feature;
              });
            });

          map.infoWindow.setFeatures([deferred]);
          map.infoWindow.show(event.mapPoint);
            map.infoWindow.resize(150,200);
           
           setTimeout(function(){map.infoWindow.hide();},3000);
          
        }

Outcomes