I have an application showing cadastral parcels. When a parcel is clicked, the applications makes zoom to the extent of this feature and prepares a floating pane where it is possible to load some layers specific to that parcel.

The problem is that I think that when the studied feature is clicked, there are lots of lines, points and polygons around that feature, so it is a bit difficult to concentrate in the feature that user is studying.

So I would like to know how can I add a shade or a grey overlay to everything that is NOT the selected feature, so the user has highlighted only what has selected. Then, clicking on a close button or similar, shade has to go out. Yes, it is a pure aesthetic question, but I would like to give to my application a serious and professional look. :-)

Please, consider that at this point, there could be up to 5 or 6 different layers loaded in the map.

Does anyone know how to do this process? I am not sure if it is possible to hide everything except one feature of one of the loaded layers.

PD - Just to provide an example. Check the first item of the "What I would like to do" section in this question.

1 Answer 1


When the user clicks the map perform a query task on the layers you would like the user to be able to select. The identify will return a feature geometry which you could then add to the map as a graphic. Having added the graphic loop through all of the layers and set the opacity to 0.5 which will fade them out (not grey them out). The only issue I can see with this approach is matching the symbology of the selected feature, but normally you would change the symbology of a selected feature anyway. If you wanted to keep symbology perhaps you could add a duplicate Feature Layer (a duplicate for each of the tile/dynamic layers you want them to select) which is used in MODE_SELECTION so the feature would be returned when the user selects. I assume feature layers return the symbology, I haven't really used them that much.

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.