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 have some 100 features in my ArcMap Project. I choose at TOC the View mode "List by drawing order". How can I sort this list ascending or by name alphbetical? Under the options field, is nothing like this. The drawing order should be ascending by name. Or how can I sort them on other way?

Thanks for any help.


share|improve this question

I wrote a script using MoveLayer and a temporary Group Layer to get this to work. First create a new group layer anywhere in your TOC (it doesn't matter what it's called, it will be deleted at the end). This only works based on the assumption that this temporary group layer is the only one in the mxd. Of course, this can be bypassed by giving your temporary layer a constant name (such as "TempGroup"), and changing the script to use that group layer specifically for the sorting.

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0] # Assuming one data frame
group_lyr = [lyr for lyr in arcpy.mapping.ListLayers(mxd) if lyr.isGroupLayer][0] # The temp group layer should be the only one
lyr_names = sorted( for lyr in arcpy.mapping.ListLayers(mxd) if lyr.isFeatureLayer)

for name in lyr_names:
    arcpy.mapping.MoveLayer(df, group_lyr, arcpy.mapping.ListLayers(mxd, name)[0], "BEFORE")

arcpy.mapping.RemoveLayer(df, group_lyr)

Gist is here. I am using ArcGIS 10.3.1 for Desktop.

share|improve this answer
add those lines in the end of Cindy Williams code: del mxd – newGIS Dec 31 '15 at 14:59

There is no way to sort the List By Drawing Order TOC (without programming).

But it is possible to sort the List By Visibility TOC and the Listing by selection TOC: Go to the option button on the TOC. On the Preferences tab chose whether to sort layers by the order they are drawn or alphabetically by layer name (Sort layers by).

share|improve this answer
Thanks. But I know the other sorting ways. Esri help describe that ways. But not my case what I need. How can I program it? I found something with PLTS but found nothing in that way. Thanks again for any advice. – Luis Dec 12 '12 at 14:36

yes you can do it

Sorting the table of contents in alphabetical order, please find detail in:

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

This looks like it is possible only when you have this extension, and not plain ArcMap. – Devdatta Tengshe Jun 12 '13 at 4:24

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.