How to "link" two map frames with map series using Arcpy?

263
1
01-20-2022 06:34 PM
Newuser27
New Contributor

I am trying to create a two panel map layout where the first map frame has a map series enabled and the second map frame copies the extent of the first map frame but it is one page ahead.

I can currently do this is ArcMap using arcpy, but I cannot seem to get the functionality to work in Pro.  

I have tried this, but the second map frame will not iterate as the first map frame changes pages:

aprx = arcpy.mp.ArcGISProject("current")
one = aprx.listLayouts()[0]
df1 = one.listElements("MAPFRAME_ELEMENT","Map Frame")[0]
df2 = one.listElements("MAPFRAME_ELEMENT","Map Frame 1")[0]
ms = one.mapSeries

for pageNum in range(1, ms.pageCount):
    #set map series to have the extent of the PageNum + 1 (one page ahead)
    ms.currentPageNumber= pageNum + 1
    #get extent of Frame 1 and set Frame 2 to have the same extent as the first frame  
    extent = df1.camera.getExtent()
    df2.camera.setExtent(extent)
    #reset the extent of the first Frame back to the correct page
    ms.currentPageNumber= pageNum
 
Does anybody have any ideas?  Thanks.
   
0 Kudos
1 Reply
KariBuckvold
Occasional Contributor

Did you ever figure this out?  This hack was really helpful in desktop but I need to get this going for Pro.

0 Kudos