AnsweredAssumed Answered

ImageServiceIdentifyTask doesn't execute

Question asked by ndilekli on Sep 11, 2018
Latest reply on Sep 12, 2018 by ndilekli

I would like to calculate the elevation of each point during an edit session. I am capturing the location of the edited point using the before-apply-edits event. However, I could not get the ImageServiceIdentifyTask to execute (Also tried IdentifyTask in case I was missing something).

 

I can manually query my imageservice at demImageURL successfully from the ArcGIS REST Services Directory on my server.

 

I am adding the code. What am I missing? Thanks.

 

    systemEditor.startup();

    identifyDemTask = new ImageServiceIdentifyTask(demImageURL);
    identifyTask = new IdentifyTask(demImageURL);

    identifyParams = new IdentifyParameters();
    identifyParams.tolerance = 3;
    identifyParams.width = map.width;
    identifyParams.height = map.height;
   
    systemEditor.templatePicker.on("selection-change", lang.hitch(this, function () {
    
        var selected = systemEditor.templatePicker.getSelected();
        if (selected) {
            var featureLayer = selected.featureLayer;

            On.once(featureLayer, "before-apply-edits", lang.hitch(this, function (evt) {
                if (evt.adds && evt.adds.length > 0) {
                    var imageParams = new ImageServiceIdentifyParameters();
                    var point = new Point(evt.adds[0].geometry.x, evt.adds[0].geometry.y, evt.adds[0].geometry.spatialReference);
                    imageParams.geometry = point;
                    imageParams.mapExtent = map.extent;

                    identifyParams.geometry = point;
                    identifyParams.mapExtent = map.extent;
                    var deferred = identifyTask
                    .execute(identifyParams)
                    .addCallback(function (response) {
                        // I see nothing here
                        console.log(response);
                    });
                 
                    var deferred2 = identifyDemTask
                    .execute(imageParams)
                    .addCallback(function (response) {
                        // I see nothing here
                        console.log(response);
                    });

                    if (evt.adds[0].attributes.hasOwnProperty('elevation')) {
                        // to go inside the deferred execution
                    }
                    systemEditor.attributeInspector.refresh();
                }
            }));
        }
    }));

Outcomes