Add graphic element with ArcPy

1387
2
10-19-2010 01:43 AM
Status: Open
Labels (1)
XanderBakker
Esri Esteemed Contributor

It would be nice to be able to use the Mapping module of ArcPy to add new elements to a layout. At this moment the suggested procedure is to pre-author the element and position it outside the layout. Using ArcObjects it is simple to create new elements, but since VBA is being phased-out and the alternative is creating a python script, these simple tasks should be possible without the need to create an Add-In.

2 Comments
DanielaBramante

It would be useful to add an "InsertLayoutElement" function to arcpy.mapping. Given each of the element properties, it should be an easy addition.

This would allow for the insertion of all element objects outlined in "ListLayoutElements".

DavidMahoney

Even better, maintain the list of graphic elements in a structure compatible with a python list. The list ordering could determin z-order of the elements. I would love to be able to do something like:

>>> text = TextElement()
>>> text.Text = "Map Title"
>>> mxd  = MapDocument("CURRENT")
>>> mxd.LayoutElements.insert(0,text)
>>> mxd.LayoutElements
[<TextElement object at 0x293b0850[0x293b0160]>, <DataFrame object at 0x293b07d0[0x28cc8890]>]


While we're at it, make the mapping API a little more object-oriented, putting the layout elements in as a property of the map object.