Remove Mapview and layout

1927
7
11-25-2020 07:47 AM
Status: Implemented
Labels (1)
cwh
by
New Contributor III

I would like to be able to remove mapviews and layouts using arcpy. To me this seems like something arcpy should have the ability to do. 

To provide a simple use case. I have a python toolbox which is used to create/setup new arcgis pro projects for planning applications. The toolbox uses a 'seed project' as the base for creating the new project. The seed project has all mapviews/layouts that could be used by all application types. But some application types do not use all mapviews/layouts. This is why for us it would be helpful if there was a way with arcpy to remove mapviews/layouts which are not needed for certain application types.

Thanks!

7 Comments
JeffBarrette
Status changed to: Under Consideration

This is something we definitely want to be able to do with arcpy.mp at the Project level.

Deleting project items such as maps and layouts as well as duplicating them could be very useful for automation and general project cleanup.

We already have an existing issue for this:

https://devtopia.esri.com/ArcGISPro/arcpy.mp/issues/62

 

JeffBarrette

Thank you for your submission CWH!

To clarify, do you want to delete map views or maps?  A map view is simply a view window in the application for viewing the contents of a map.  A map is a project item that is viewable in a map view (window).  We have future plans to be able to manage project items like maps, layout, folder connections, etc. 

Not only would I like to delete a map (or layout) from a project, but I may also want to duplicate (i.e., copy/paste) one with arcpy.mp as a starting point for automation purposes.

Please confirm map or mapview

Jeff - arcpy.mp Team

cwh
by

Hi @JeffBarrette 

I want to be able to remove/delete mapview and layout from the project.

In my use case the "seed project" has one layout associated with each mapview. So if a application type is chosen that does not use all mapview (for example application type 'Development Permit' does not have a Proposed Use, so I would want to use arcpy to remove the Proposed Use Mapview and Proposed Use Layout.

Thanks,

Chris

DougZietz1

@JeffBarretteI would like to delete the maps themselves. I connect to the APRX using the arcpy.mp.ArcGISProject() method and then list the maps in it and it still shows deleted maps. Besides starting a new project, is there a way to delete these maps permanently? I'm using 2.8.0 currently and not sure of the next upgrade cycle.

JeffBarrette

@cwh if you simply want to close map, layout "VIEWS", it can be done using Pro 3.0.  We added a new ArcGISProject.closeViews() function and this will address your needs.  We also added Map/Layout.openView()

At 3.1, we are adding the ability to remove Project Items.  This includes Maps, Layouts, and Reports.

If you are satisfied with only closing views, then we can close this idea.  If you are also interested in removing project items, then we can keep this open and I'll mark it appropriately.

Jeff - arcpy.mp and Layout teams

cwh
by
This sounds great!
Thanks you
JeffBarrette
Status changed to: Implemented

Add ArcGISProject.closeViews() at 3.0.

Jeff - Layout and arcpy.mp teams