query features in a given polygon

520
2
04-16-2012 08:17 AM
RashaGarfinkel
New Contributor
I am new to the ArcGIS API for Javascript - I have to draw a polygon & on finish drawing get a list of the features within the polygon extent - I was able to draw the polygon - not sure what API methods to use to get the visible features withng the polygon extent - any help would be greatly appreciated

Thanks
0 Kudos
2 Replies
derekswingley1
Frequent Contributor
Use the geometry from your polygon graphic as the query.geometry property used with a query task.

The query for polygon and adjacent polygons sample shows using a polygon with a query task.
0 Kudos
RashaGarfinkel
New Contributor
Thank you - to take it one step further once I have the features how would I display them in a tree like structure - name of feature layer - feature names
similar to the layers widget that displays the layer name & feature layers under the layer name
0 Kudos