Select to view content in your preferred language

Identify Task on Point/Line Features

722
1
05-18-2010 12:13 PM
MuhammadRiaz
New Contributor
Hi Guys,

I want the user to click on a point/line feature on the map and display the feature's attributes in a grid. I am using Identify Task to perform this action but for some reason no attributes are being returned. My code snippet is below:

var identifyTask = new esri.tasks.IdentifyTask("Rest API URL");
var identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 5;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [10];
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
identifyParams.width  = map.width;
identifyParams.height = map.height;
identifyTask.execute(identifyParams,results);

I am not sure what I am doing wrong, any comments/ideas would be appreciated.

Thanks!
0 Kudos
1 Reply
AlessioDi_Lorenzo
Emerging Contributor
Your snippet shows only the identify settings but tells nothing about the callback function you defined to extract the attributes and create the grid.

Look at this example. It is about find task, but you can adapt it at your case.
In the linked example the callback function, called showResults(), takes the task results as a parameter and populate an array with the attributes through a for cicle. Then the attribute's array is used in dojo datastore item property.
0 Kudos