ArcGIS Pro: Arcpy View Layout (make viewable)

553
1
03-16-2020 07:53 PM
Status: In Product Plan
Labels (1)
TimothyBarnes
Occasional Contributor

There is a method in arcpy to import a layout into a ArcPro document (aprx.importDocument('path to pagx').

This imports it into the project but does not show the layout by default so a user may not know that the layout had been added (i.e. it requires use of the Catalog view in the UI to navigate to that layout and then view it/open it).

There are also other project items which it would be useful to have arcpy control over their visibility status in the main stage (i.e. maps, scenes)

Please add a property on maps, layouts, scenes etc to control their visibility.

i.e.

aprx = arcpy.mp.ArcGISProject("Current")

aprx.importDocument("path to pagx file")

layout = aprx.listLayouts('pagx layout I just imported")[0]

layout.visible = True # This will show the layout in the main stage

layout.visible = False # This will remove the layout from the main stage, but still keep it in the project.

1 Comment
JeffBarrette
Status changed to: In Product Plan

This is addressed in Pro 3.0.  Similar to your idea, we have an OpenView() method on the Layout and Map objects.  We also have a ArcGISProject.CloseViews() method too.

So to address your scenario, before importing a pagx, you might want to also close all other map and layout views.

p = arcpy.mp.ArcGISProject('current')
p.importDocument(pagx_path)
p.closeViews() #Default is "MAPS_AND_LAYOUTS"  or "MAPS" or "LAYOUTS"
lyt = p.listLayouts('MyLayout')[0]
lyt.openView()

I hope you are excited by this new feature.

Jeff - Layout and arcpy.mp Teams