The Identify task finds features in one or more map layers of an ArcGIS Server map service exposed as a REST resource. Features are found that intersect the input geometry, which is contained along with other search parameters in an IdentifyParameters object. The result of this operation is an IdentifyResults object.

Namespace:  ESRI.ArcGIS.VE
  (in ArcGISVE.exe)

Syntax

JScript
 class IdentifyTask

Remarks

The IdentifyTask is one of several tasks that may be used to find features. See "About tasks" in the Getting Started section for a guide to available tasks. See the walk-through Identify or find features near a location for a full example of using the IdentifyTask.

To use the IdentifyTask, create an instance of the class, as well as an instance of IdentifyParameters. Set the properties for the identify, then Execute the task, passing the return function name. Create the callback function with the IdentifyResults as its input parameter. In the callback function, use the IdentifyResults.InputGeometry to add a single pushpin with description text for the features found. Or use IdentifyResults.ToVEShapeLayer to display the shapes of features found. The code snippet below shows the basic approach; the ExecuteTask function here has a hard-coded location, but typically the location would obtained dynamically, such as through a user click on the map (see the walk-through for a code example). This code assumes a map already created as a VEMap.
Copy 
function ExecuteTask() {
    var idTask = new ESRI.ArcGIS.VE.IdentifyTask();
    idTask.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer";
    var idParams = new ESRI.ArcGIS.VE.IdentifyParameters();
    var mapDiv =  $get("map");
    identifyParameters.Width = mapDiv.clientWidth;
    identifyParameters.height = mapDiv.clientHeight;
    identifyParameters.MapExtent = map.GetMapView();
    idParams.LayerIds = [3, 5];
    var vePixel = new VEPixel(-114.0, 37.0);
    var vePoint = new VEShape(VEShapeType.Pushpin, vePixel);
    idParams.Geometry = vePoint;
    idParams.Tolerance = 3;
    idTask.Execute(idParams, addShapes);
 }

 function addShapes(idResults) {
    if (idResults.Error != null)
       alert("Error: " + idResults.Error.message);
    else {
       var shape = identResults.InputGeometry;
       if (shape.GetDescription().length==0)
          shape.SetDescription("Unable to identify any map features at the click location.");
       shape.Show();
       map.AddShape(shape);
    }
 }

See Also