Monday 22 August 2016

arcgis desktop - Is it possible to create a data frame graphic using arcpy?


I'm interacting with an MXD using arcpy, and wish to create a graphic within a data frame - as with the Draw toolbar when working manually. The GraphicElement page says...



The GraphicElement object provides access to properties that enables its repositioning on the page layout as well as methods that allow for duplicating and deleting existing graphic elements.



...which doesn't mention the ability to create a new graphic element. Is there another area I should be looking at in arcpy, or is this not currently supported?



Answer



You are coming up against an ArcPy software limitation.


Although you cannot create a GraphicElement from scratch, as long as you have one graphic element present in your layout (even if it is placed off the page), then:




Existing graphic elements can be cloned and deleted. This capability was initially added to support the creation of dynamic graphic tables on a page layout where each cell in the table can be outlined using line graphics.



I take copies of an "off the page" graphic element and then move, resize, etc them.


The same workaround can also be used for text elements.


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