Online ArcGIS resource help provides a list of layer properties which can be used as needed. I am not able to find a way to collapse a layer using ArcPy in it. Please suggest if there is a way to collapse a layer in current data frame.


It may not be a great solution but if you have saved layer files with them collapsed then RemoveLayer followed by InsertLayer sounds like it could do it:

The way a layer appears in the table of contents (TOC) after it is added depends on the source layer and how it appears. For example, some layers are completely collapsed and do not display their symbol(s) in the TOC. This setting is built into the layer. If a layer is collapsed, saved to a layer file, and then added to a map document, the layer will be collapsed in the new map document when added via InsertLayer.

However, my suggestion is that you vote for this ArcGIS Idea.

  • I am not sure if I understand it correctly, but raster layers are generated as part of geoprocessing during current session so they are saved on hard disk and not to be saved as part of current mxd file -- automatically loaded in current data frame as not collapsed. Thanks for suggestion, I voted for it. – Ibe May 17 '13 at 20:02
  • You should be able to suppress the automatic load using one of the Geoprocessing options here. That way I think you should be able to get control over adding the collapsed layer file and replacing its data source with the raster data you have just created. – PolyGeo May 17 '13 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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