Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am identifying features from an ArcGISDynamicMapServiceLayer

All the sublayers can be toggle on/off and when identifying, only the visible layers are queried/returned. Below are the initIdentify and executeIdentifyTask functions.

   dojo.connect(map, "onLoad", function(map) {initIdentify(map);});

   function initIdentify(map) {             
            //create identify tasks and setup parameters
            identifyTask = new esri.tasks.IdentifyTask("");                
            identifyParams = new esri.tasks.IdentifyParameters();
            identifyParams.tolerance = 3;
            identifyParams.returnGeometry = true;
            identifyParams.layerIds = wmsLayer.visibleLayers;               
            identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
            identifyParams.width = map.width;
            identifyParams.height = map.height;             
            dojo.connect(map, "onClick", executeIdentifyTask);

   function executeIdentifyTask(evt) {
            if (visibleLayers.length === 0){                    
            } else {
                identifyParams.geometry = evt.mapPoint;
                identifyParams.mapExtent = map.extent;
                identifyParams.layerIds = wmsLayer.visibleLayers;               
                identifyTask.execute(identifyParams, function(idResults) { fillInfoWindow(idResults, evt); });                   

When the identify function is run, is there a way to highlight/select those features that are being identified?

share|improve this question

Create a FeatureLayer on top of the dynamic layer, with the same service source (except, obviously, using the correct layer in the map service rather than just the map service, e.g.

As some part of your event handling (you could make it a new handler, make it part of executeIdentifyTask, part of fillInfoWindow, part of the anonymous callback on your Identify Task, or an additional callback on Identify Task), execute SelectFeatures against your featureLayer.

For SelectFeatures, use your evt.mapPoint as the geometry for your Query geometry and esri.layers.FeatureLayer.SELECTION_NEW for your selectionMethod. Everything else should be able to use the defaults.

Remember to use FeatureLayer.setSelectionSymbol(symbol) to define the symbol for the selection.

share|improve this answer
thanks blord-castillo.. is that what you did in this example to get the identified features to appear selected? – snowgage Mar 15 '13 at 19:43
That's actually a different concept using the popup dijit. I completely forgot about that idea, and it can actually do exactly what you want! – blord-castillo Mar 15 '13 at 19:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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