This sample demonstrates how to execute an attribute and spatial query on the sublayers of an ArcGIS map image layer. Sublayers of an AGSArcGISMapImageLayer may expose an AGSServiceFeatureTable through a table property. This allows you to perform the same queries available when working with a table from an AGSFeatureLayer attribute query, spatial query, statistics query, query for related features, and so on.
How it works
The AGSArcGISMapImageLayer in the map uses the `USA` map service as its data source. This service is hosted by ArcGIS Server, and is composed of four sublayers: `states`, `counties`, `cities`, and `highways`. The sublayers (represented by AGSArcGISMapImageSublayer), expose an AGSServiceFeatureTable through a table property. A query is created to find features with a population greater than the value provided that are also in the current map extent. Since the `cities`, `counties`, and `states` tables all have a `POP2000` field, they can all execute the same query. The features selected by the query are selected in the corresponding layers to display the results in the map.