I'm contemplating how to set up my function so that it accepts a geometry (the user will be able to use the draw toolbar to create the search geometry) and will 'query' any layer in the map that is visible.
* All results will get written to a central graphics array so that I can put the results in a side panel, display 'selected' graphics on the map, and highlight the current attributes being viewed in the side panel.
* The map uses different layer types that all need to be queried at once and the results managed together: ArcGISDynamicMapServiceLayer, FeatureLayer, CSVLayer (from local user file), GraphicsLayer (build on demand from JSON string)
* Search geometry could be a point, line, or polygon
* Map layers could contain point, line, or polygon features/graphics
- Loop through all of the layers in the map to determine the type of layer
- Using layerIds, graphicsLayerIds, and basemapLayerIds gets me part of the way there
- I also test if the 'capabilities' property is present and if it supports Query or Identify
- If the layer ID is in layerIds and Identify is supported then create and run an IdentifyTask
- If the layer ID is in graphicsLayerIds and Query is supported then I'm thinking it would be a feature layer and I could use featureLayer.selectFeatures
- Anything else in the graphicsLayerIds I would test if graphics > 0
- I was considering using the relation geometry service but I've seen a lot comments that people abandoned this type of approach because of asynchronous timing issues and not being able to trace back to the original layer(s) to get the full graphic result
- I also considered creating 'local' feature layer, one that is built from a FeatureCollection and doesn't come from ArcGIS Server, but when you do that it doesn't seem to support the Query capability
Suggestions on any of this would be appreciated.