Select to view content in your preferred language

ExportToPDF a data frame instead of the page layout doesn't export other map elements

843
2
02-14-2013 02:48 PM
JohnKidd3
Deactivated User
Hi, I've been trying to automate the creation of county maps at a constant scale of 1:63360. To maintain scale, I have to change either the page size or the data frame size. I don't think there is a way to change page size using arcpy, or is there? But it's pretty easy to change data frame size using arcpy. But then, rather than export the page layout, I would like to export the data frame. This works great, and it's fun to watch the data frame jumping around to fit each county, but when I export using
ExportToPDF(mxd, "file.pdf", df, df_export_width=1600, df_export_height=1200), it doesn't export the legend or any text elements in the data frame. Is there a way to export the data frame along with all the other map elements? Would grouping the other elements with the data frame work? If so, how do you group elements in arcpy? Thanks!
0 Kudos
2 Replies
JeffMoulds
Esri Contributor
There are currently no properties to change the page size using arcpy. That's more of an ArcObjects thing. As a workaround, you could create MXDs for each page size and orientation you needed. I don't know how much variation there is in size/shape between all the counties you need to print/export. Hopefully you can get away with just a having a few different MXDs. For example: small portrait, small landscape, large portrait, large landscape. You would have to build in some logic as to what mxd you would use for what county. Perhaps a table or logic based on extent size.

The closest sample I can think of is the topic on creating a map book with facing pages. The data frame sizes are the same (unlike your workflow), but two map templates are needed - left page and right page. http://resources.arcgis.com/en/help/main/10.1/#/Creating_a_map_book_with_facing_pages/00s90000002p00...

If the changes you need to make to the data frame element width/height in the layout are quite small, you could try changing the  MapSurroundElement width and height properties, then you would only need one mxd. However, this would only work if there were small variations in size and shape between your counties, which is unlikely.

In regards to your question about printing the data frame, you will not get the legend or any map surround stuff that lives on the layout (scale bar, north arrow, layout text, etc). Exporting the data frame just gives you the data frame and is not the same as exporting the layout.

Tip: the Map Automation forum is better for arcpy.mapping and map book questions.
0 Kudos
JohnKidd3
Deactivated User
Thank you Jeff. I appreciate the information. And sorry about using the wrong forum. I thought I was in Map Automation but obviously clicked the wrong link.
0 Kudos