I have a map document which contains several text elements that I have grouped and am able to programmatically update. These groups represent a page of data.
Now I'd like to export this data as a two-page PDF. Where Group 1 = page1 and Group 2 = page 2. I've been looking to data driven pages but can't get my head round if this is even possible.
I understand how to use Data Driven pages for changing map extents (Data Driven Pages and exporting PDF using Python) etc.. but not this specific issue of moving text element groups to and from the layout page, taking a snap-shot as the next page, and exporting as a map book.
Does anyone have experience with this making multi-page PDFs by moving text elements across the layout page? - I hope the image below indicates what I'm trying to do in ArcMap 10.2
Answer
You can list text and other graphic elements with arcpy.ListLayoutElements()
. This will even give you the option of returning only text elements, graphic elements, mapsurround elements (like north arrow, scale bar). For each of these elements you can set its location by setting the X and Y properties e.g. element.elementPositionX = 12.5
.
This allows you as well to move certain elements (temporarily) off the page, by setting coordinates which are outside your page sheet.
Be sure to always refresh the view by using arcpy.RefreshActiveView()
or your layout won't be updated.
More info on text elements: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/TextElement/00s30000000m000000/
In reply to your comment: yes it is possible to perform operations on group elements as well. They are listed as GRAPHIC_ELEMENT
. You can make it easier to identify them in your list of layout elements when you give the elements names when viewing the properties in arcmap (tab 'size and position'). I was able to move a whole group of elements by accessing the group element through the list and then do element.elementPositionX += 20
.
Also, I said before you should use arcpy.RefreshActiveView()
, it should be mxd.save()
where mxd
is your MapDocument object.
No comments:
Post a Comment