Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

Luis

share|improve this question

3 Answers 3

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: http://resources.arcgis.com/en/help/main/10.1/index.html#//0106000001qt000000

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

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).

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(lyr.name 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.

share|improve this answer

Your Answer

 
discard

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.