AnsweredAssumed Answered

how to get arcgis IdentyfyTask addCallback `s value?

Question asked by guriguri1576 on Jun 14, 2016
Latest reply on Jun 14, 2016 by guriguri1576

i was tested to the IdentyfyTask.

 

 

But I could not get a response before the value addCallback.

 

 

i want to the pnu values.

 

 

But pnu vaule was alwayes undefined...

 

 

 

 

 

 

my code is follows.

 

 

    function poiClick(){

    agmap.addEvent("click", function(evt){

  

    getPoi= krcgis.Function.PoiClick(agmap ,evt);

    

    console.log("X === ",getPoi.x);

    console.log("Y === ",getPoi.y);

    console.log("PNU === ",getPoi.pnu);

    });

    }

   

     PoiClick : function(map, evt) {

    poiInfo = {};

    poiInfo.x =evt.mapPoint.x;

    poiInfo.y =evt.mapPoint.y;

    var targetLayerId = 'LP_PA_CBND';

    var url = map.Layers.getLayerInfo(targetLayerId).SVC_URL;

    var map = map.getMap();

    //파라미터 설정.

    var idParams = new krcgis.core.tasks.IdentifyParameters();

    idParams.geometry = evt.mapPoint;

    idParams.mapExtent = map.extent;

    idParams.returnGeometry = true;

    idParams.tolerance = 0;

    idParams.layerOption = krcgis.core.tasks.IdentifyParameters.LAYER_OPTION_ALL;

    idParams.width = map.width;

    idParams.height = map.height;

  

  

    idTask = new krcgis.core.tasks.IdentyfyTask(url);

    idTask

    .execute(idParams)

    .addCallback(function (response) {

    if (response) {

    poiInfo.pnu =response[0].value;

    }

    });

    return poiInfo;

    }

 

 

 

 

The results were as follows.

 

123.png

Outcomes