I know how to change settings of a legend individually by arcpy (like: Patch, Title, Items, Columns, Frame, Element Size & Position, etc.), but now I would like to use the exact legend settings another time and load them using ArcPy.
Is there a simple way to save/load these legend settings all together in/from a text file?
Best Answer
So it looks like you know how to get at the elements you need, and they are all read/write. I've done something similar where I read properties from a raster and write them out to a XML configuration file that in turn gets read by another Python script and the raster parameters get fed into a 3D modeling package.
xml.etree.Elementree
andxml.dom.minidom
are the key modules (at least for my version).First, read your legend elements and get the values into variables, then write them out to XML. Below,
<..>_element
each represent a element that I write out, wheref
is a file named Config.xml:This gives me a XML file like so:
I then read the XML in another application (this below needs cleaned up some, but it works):