Wednesday, 13 July 2016

arcgis 10.0 - Resequencing Legend Items using ArcPy?


I create various layers programmatically using ArcPy.


I can adjust how the layers are sequenced using the arcpy.mapping.MoveLayer command.


However, I want to have the legend reflect a different order. I have yet to figure out how to do this in Python.


I have tried using legend.autoAdd=True or False. I think I am close in using:


legend=arcpy.mapping.ListLayoutElements(mxd,"LEGEND_ELEMENT","My Legend") [0]

and then legend.items.something.



I have four legend items A, B, C, and D which appear incorrectly as D, C, A, B.


Can anyone provde a link to code examples or better documentation?




This question was originally posed for ArcGIS 10.0 but another question (Moving legend items up and down with arcpy) using ArcGIS 10.2 has been merged into it so answers using any version from and including 10.0 should be acceptable.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...