The FindTask searches for specified text in one or more map layers
of an ArcGIS Server map service exposed as a REST resource. The arguments for the
search are set in a FindParameters object. The result of this operation is a
FindResults object.
Namespace:
ESRI.ArcGIS.VE(in ArcGISVE.exe)
Syntax
| JScript |
|---|
class FindTask |
Remarks
The FindTask 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
Finding features on the ArcGIS Server map for a full example of using the FindTask.
To use the FindTask, create an instance of the class, as well as an instance of FindParameters. Set the properties for the find, then Execute the task, passing the return function name. Create the callback function with the FindResults as its input parameter. The code snippet below shows the basic approach; the ExecuteTask function would be triggered, for example, by a button on the page. This code assumes a map already created as a VEMap.
Copy
To use the FindTask, create an instance of the class, as well as an instance of FindParameters. Set the properties for the find, then Execute the task, passing the return function name. Create the callback function with the FindResults as its input parameter. The code snippet below shows the basic approach; the ExecuteTask function would be triggered, for example, by a button on the page. This code assumes a map already created as a VEMap.
function ExecuteTask() { var findTask = new ESRI.ArcGIS.VE.FindTask(); findTask.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"; var findParams = new ESRI.ArcGIS.VE.FindParameters(); findParams.SearchText = "Delaware"; findParams.Layers = [3, 5]; findTask.Execute(findParams, addShapes); } function addShapes(findResults) { if (findResults.Error != null) alert("Error: " + findResults.Error.message); else { var lineColor = new VEColor(255,255,0,.8); var fillColor = new VEColor(255,255,0,.3); findResults.SetShapeStyle(lineColor, 2, fillColor, true, "Select results"); var veLayer = findResults.ToVEShapeLayer(); map.AddShapeLayer(veLayer); } }
