Select to view content in your preferred language

Multiple Pages in a Single Layout

19790
24
01-13-2021 10:47 AM
Status: Open
Labels (1)
jcarlson
MVP Esteemed Contributor

Before I came to work at an ESRI workplace, I was an avid QGIS user. Still am, really, but as ArcGIS Pro has developed, I find myself needing to use Q less and less to hack together an as-yet-unimplemented feature in Pro.

(Major props on the eyedropper!)

There is, alas, still one feature that I desperately want: multiple-page layouts.

In the course of my work, there are a number of times when it is helpful to have spatial and non-spatial components on separate pages, and the sheer amount of information in my layout cannot realistically be squeezed into a single page. Or at least, not that the average person could print out. I'm all for digital maps, but I know we have other folks in our county who want it on paper, and I'd like to conveniently oblige them.

The biggest of these items are our Change Records we generate when changes are made to the cadastre.

Here's one for reference.

Combining multi-page layouts with a Map Series would absolutely make my day.

What are my alternatives?

  1. Make each page a separate layout
  2. Use some sort of mail merge procedure to generate the non-spatial pages
  3. Make my layouts potentially tabloid-sized
  4. Use Python
  5. Use QGIS

Options 1 and 2 create separate files, which then have to be merged together, adding more steps and intermediate file storage to what is currently a batch process.

Option 3 we tried, but the increased loading time and unprintable nature of the page was not desirable for our users.

Option 4 is a maybe, but there's no way the spatial component will look half as nice as Pro, especially when it comes to labelling.

Option 5 is what I'm currently doing, but it comes with a host of its own limitations, and means that I have to work in two programs during my "weekly update" process, which is sub-optimal.

Final note: I've tried making a reeeeeeally tall layout in Pro and hoping that in the "Print to PDF" process it would cut them, but no. It just generates a really tall PDF.

24 Comments
JeffBarrette

@DougBrowning @PhilipMarty @JenMar_ A multi-page export per Map Series page is completely doable using arcpy.mp.  The UI does NOT provide these capabilities but the arcpy.mp API does.  All a spatial map series is are a bunch of properties that are based on the extent of each index feature.  If you use Python to drive the map series export (vs the UI), you can inject additional logic between each MapSeries page export. This even includes updating the extent of a map frame in another layout.

 

The closest example I can think of is a sample I wrote for ArcMap Data Driven pages (not updated but the logic is identical).  This example, uses 2 MXDs because only one layout per MXD is possible.  But Pro supports multiple layouts so you don't need multiple projects.

https://www.arcgis.com/home/item.html?id=41f949b33f614f78a6dee485c4aaa5a8

Take a look at the code - it displays two map frames (even pages and odd pages) on a single layout rather than being forced to have one PDF per map series page.  You will see the main loop is based on one MXD that drives the data driven pages (in Pro called Map Series) and the second MXD has two separate map frames.  The extra logic happens between pages and the exactly one PDF is exported for every two strip index features.  It uses arcpy.mp to append the pages in the correct order creating a final, single, multi-page PDF.  One of you even mentioned NOT exporting a map series page if particular criteria are not met - using Python you decided when to export, etc.

If this sample does NOT make any sense at all, I can try to write up a snippet but the logic will be the same.

Jeff

 

 

JeffBarrette

@DougBrowning @PhilipMarty @JenMar_  Ah, I couldn't resist so I created a very simple script that creates 2 pages for every page in a map series.  The first is a map centric page based on a map series and the second page is a dynamic table (also based on a map series).  Both pages are synchronized to use the same map series page number.  They both don't need to use a map series.  You can use whatever logic you want.

Here is a snippet of code that does it all:

import arcpy, os, sys
relpath = os.path.dirname(sys.argv[0])

#Set file name and remove if it already exists
pdfPath = os.path.join(relpath, "Final.pdf")
if os.path.exists(pdfPath):
os.remove(pdfPath)

#Create the file and append pages
pdfDoc = arcpy.mp.PDFDocumentCreate(pdfPath)

#Reference project and appropriate layouts and map series objects
p = arcpy.mp.ArcGISProject(os.path.join(relpath, "MSWith2PagesPerPage.aprx"))

#Landscape layout with dynamic Map Series table
lyt2 = p.listLayouts('TableData_MS')[0]
ms2 = lyt2.mapSeries

#Portrait layout with Main Map Frame and Locator Map Frame with map series
lyt1 = p.listLayouts('Layout_MS')[0]
ms1 = lyt1.mapSeries

#Iterate through each map series page driven by Layout_MS
for pageNum in range(1, ms1.pageCount + 1):

#Set the Map Series page, export, and append to the final output
ms1.currentPageNumber = pageNum
lyt1Output = os.path.join(relpath, "TempPageA.pdf")
lyt1.exportToPDF(lyt1Output)
pdfDoc.appendPages(lyt1Output)
os.remove(lyt1Output) #Clean up temporary file after appending

#Sync the second layout to match the same Map Series and export
ms2.currentPageNumber = pageNum
lyt2Output = os.path.join(relpath, "TempPageB.pdf")
lyt2.exportToPDF(lyt2Output)
pdfDoc.appendPages(lyt2Output)
os.remove(lyt2Output) #Clean up temporary file after appending

pdfDoc.saveAndClose()

Capture.JPG

PhilipMarty

@JeffBarrettethis is terrific! Thank you so much. My code block was almost identical to the one you typed out. The missing link was ms2.currentPageNumber = pageNum to tie each map series together. Very cool stuff. I tied that in there, and it worked beautifully this morning.

DiogoFnds

Hi,

@JeffBarrette I would like to double on the idea proposed by @jcarlson 

It would be nice if the Map series function had an additional option, a "custom pages" option in which you can set up an indeterminate number of additional pages on your layout, each page independently customizable to the other in terms of size, orientation, number of map frames, contents. It would add an enormous degree of flexibility to the current way ArcGIS pro manages layout. Seems pretty doable and easily implementable enough. At the current stage I would have to create more than 30 different layouts for my needs, which becomes unmanageable.