Hi. I've got a Python script for exporting a MapSeries to PNG in a Project that contains multiple MapSeries. My can't seem to figure out how to specify the MapSeries to export. I've included the script below. I've been tweaking the layout_number values. It does change the MapSeries output, but I'm not sure how to determine the layout number? Any suggestions? Or is there a way to specify by "layout_name"? Thanks
_______________________________________________________
import arcpy, os, sys, pathlib
output_folder = pathlib.Path(os.path.dirname(sys.argv[0])) / "Output"
output_png_fname_pattern = "{this_row.Index}_{this_row.Index}.png"
layout_number = 0
output_folder = pathlib.Path(output_folder)
os.makedirs(output_folder, exist_ok=True)
p = arcpy.mp.ArcGISProject("CURRENT")
l = p.listLayouts()[layout_number]if not (l.mapSeries is None):
ms = l.mapSeries
if ms.enabled:
for pageNum in range(1, ms.pageCount + 1):
ms.currentPageNumber = pageNum
this_row = ms.pageRow
output_fname = output_png_fname_pattern.format(this_row=this_row)
l.exportToPNG(output_folder / output_fname,
transparent_background=True,
clip_to_elements=True,
resolution=300)