AnsweredAssumed Answered

Use the address from a Search as the point to identify a county

Question asked by schlot on Aug 20, 2015
Latest reply on Aug 20, 2015 by schlot

I want to be able to use the point of an address as the input geometry to my IdentifyTask.  I'm having a scope problem.  I can see that my identify task is finding the county, but I'm not calling/returning that name properly.  I'm sure I'm not using lang.hitch properly, but I can tell that select-result was completing before runIdentify ever started.


searchTool is my Search widget.

       on(searchTool,'select-result', function (evt){
         var addr =;
         app.addrExt = evt.result.extent;



define ([ "dojo/on", "esri/tasks/IdentifyTask","esri/tasks/IdentifyParameters",
      ], function (  on,IdentifyTask,IdentifyParameters,Point,Extent,webMercatorUtils
) {  
    return {
      initIdentify: function(url){
        app.idTask = new IdentifyTask(url);
        app.idParams = new IdentifyParameters();
      runIdentify: function(){         
          var webPt = webMercatorUtils.lngLatToXY(app.addrExt.xmin, app.addrExt.ymin);
          var point = new Point(webPt[0], webPt[1], app.spatialReference);
          app.idParams.geometry = point;
          var pxWidth = /;
          var padding = 3 * pxWidth;
          var qGeom = new Extent({
              "xmin": point.x - padding,
              "ymin": point.y - padding,
              "xmax": point.x + padding,
              "ymax": point.y + padding,
              "spatialReference": app.spatialReference
          app.idParams.geometry = point;
          app.idParams.mapExtent = qGeom;
          app.idParams.tolerance = 1;
          app.idParams.returnGeometry = true;
            app.countyName = results[0].value;  // the identify is finding the county name here, I'm just not returning it properly
          return app.countyName;