HOW TO
In an ArcGIS Pro project, a single layout can contain multiple map frames, each referencing a different map. Identifying the maps when a layout is opened can be done through visual inspection in the Contents pane in ArcGIS Pro.
An alternative to identifying maps referenced in a layout, especially when multiple maps are involved, is by using ArcPy. The following procedure describes how to programmatically list all maps referenced in a layout in an ArcGIS Pro project using Python.
import arcpy
mapDict= {}
aprx = arcpy.mp.ArcGISProject("CURRENT")
for lyt in aprx.listLayouts():
    for m in lyt.listElements("MAPFRAME_ELEMENT"):
        if lyt.name in mapDict:            
            mapDict[lyt.name].append(m.map.name)
        else:
            mapDict[lyt.name]=[m.map.name]
print(mapDict)
The code block below demonstrates the full script.
import arcpy
mapDict= {}
aprx = arcpy.mp.ArcGISProject("CURRENT")
for lyt in aprx.listLayouts():    
    for m in lyt.listElements("MAPFRAME_ELEMENT"):
        if lyt.name in mapDict:            
            mapDict[lyt.name].append(m.map.name)
        else:
            mapDict[lyt.name]=[m.map.name]
print(mapDict)
                Article ID: 000029323
Get help from ArcGIS experts
Start chatting now