I would like to be able to identify map(s) referenced by a layout.
I have a workflow where I will be importing one or more mxd documents into a Pro project.
I would like to manipulate map layers (datasources, layer names, symbol properties, etc) for maps that are referenced by a specific layout.
Note: In my workflow a map is never referenced by more than one layout.
for lyt in aprx.listLayouts():
for map in lyt.listMaps():
...
Hello Macbeer,
This could be accomplished by iterating through the MapFrames on a layout. Once you have a MapFrame, then you can get to its associated Map. And then you can get to the layers.
Here is a snippet:
p = arcpy.mp.ArcGISProject('current')
for lyt in p.listLayouts():
for mf in lyt.listElements('MapFrame_Element'):
m = mf.map
print(f"Layout: {lyt.name}, MapFrame: {mf.name}, Map: {m.name}")
Here is a screenshot that includes the indents:
Jeff - Layout and arcpy.mp teams
Thanks Jeff - glad to see my request already exists in the current product.
I will do more research in the future to see if my 'idea' is already possible.
This can be accomplished using arcpy.mp. A sample was provided.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.