I wish to find all the features within a polygon/circle drawn by my user.

May I know if I should use IdentifyTask


Or is there a more recommended way?

Use Case: User drawn a circle/polygon and it will display all the address within the area.

  • Are all the features within a single layer in the mapservice? Jul 9, 2013 at 2:22
  • yes, apparently identifytask only return a feature...any help on this?
    – seesee
    Jul 9, 2013 at 2:24
  • The Identify task allows you to specify which layers in the mapservice you are interested in, whereas the Query task is for a particular layer. Jul 9, 2013 at 2:27

2 Answers 2


The solution is to use QueryTask.


It accepts a Query


which the a geometry parameter can be input to search for features within the specified criterias.

Using QueryTask.execute(parameters,callback,errback) method. It will return a feature set on onComplete(featureSet) callback.

which contains a property call features


By looping through the features[]. We can get the set of features within the geometry.


You can specify the geometry using the identifyparameters class: https://developers.arcgis.com/en/javascript/jsapi/identifyparameters.html

It will accept any type of geometry, typically you would pass it a point, but you could pass in a polygon that is drawn on the screen.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.