Select to view content in your preferred language

Convert a map series to individual layouts

3237
12
08-25-2022 08:19 AM
Status: Closed
Labels (1)
GregWyatt
New Contributor II

The map series is useful if all layout details are essentially the same. If you need to annotate pages differently in a substantial fashion, a map series is overly restrictive. 

If it were possible to export/convert a map series into individual maps and layouts, it would allow the user to do the majority of the work in the series, then edit the individual layouts separately.

I'm asking for the ability to convert a map series to individual maps and layouts.

12 Comments
DrewCover

@JeffBarrette Thank you, after some work on the methods, I was able to adapt the first script example to my project and output 126 site location layouts along with the referenced dynamic figure #s, sorting, and Titles I had setup in the Map Series. 

I had previously used similar script in ArcMap for DDPs to .mxds, but this worked even better to mockup many layouts for individual editing.  Muuuch faster than navigating in map series then copy/paste layout......126 times, no thank you, my pet Python is up for the tedious monotony tho!  

Next it gets adapted for location features layouts!  Pro keeps getting better for production mapping, this is the kind of workflow that saves big time and gets noticed by budget people.  A map series tool that does this would be useful.

Go Pro! Go Python! Go esri!

 

JeffBarrette

I just started to build a more complete solution to this  specific workflow and other workflows that came up during the User Conference.  I'll combine several solutions into one downloadable sample.

While I was building this workflow I realized a couple of extra steps.  First, if you simply disable a map series, any dynamic map series text or queries, etc will not work so your resulting duplicated layout will not display correctly.  Second, I found it better to remove the map series instead of disable it because once you replace the dynamic nature of these elements, re-enabliing the map series will not re-create the dynamic capabilities.

In the script below, you can see I have  code to first remove the dynamic nature of map series to be hard coded BEFORE I remove the map series from the layout using Python CIM access.

 

pageList = arcpy.GetParameter(0) #List of selected pages via script tool
removeMS = arcpy.GetParameter(1) #Boolean to remove map series from copied layout

#Reference the current project and layout
p = arcpy.mp.ArcGISProject('CURRENT')
lyt = p.listLayouts('Duplicate')[0]

#Confirm there is a map series
if not lyt.mapSeries is None:
    ms = lyt.mapSeries

    #Confirm the map series is enabled
    if ms.enabled:

        #Iterate through each choosen page
        for page in pageList:
            #Set the current map series page based on page name
            ms.currentPageNumber = ms.getPageNumberFromName(page)

            #Make the duplicate copy with new name
            cpLyt = p.copyItem(lyt, 'Copy_' + page)

            #Optional - remove the map series
            if removeMS:
                #Must convert title text from dynamic to static
                title = cpLyt.listElements('Text_Element', 'Title')[0]
                title.text = page

                #Must convert table frame from dynamic to static
                m = p.listMaps('Duplicate')[0]
                lyr = m.listLayers('State Outlines')[0]
                lyr.definitionQuery = f"STATE_NAME = '{page}'"
                
                #Remove map series
                cpLyt_cim = cpLyt.getDefinition('V3')
                cpLyt_cim.mapSeries = None
                cpLyt.setDefinition(cpLyt_cim)

 

 

I hope to make the samples available soon,

Jeff - Layout and arcpy.mp teams