Removing map from ArcGIS Pro project using ArcPy

4777
17
06-17-2017 01:53 AM
Status: Implemented
Labels (1)
GraemeBrowning
Occasional Contributor III

I have a desirable requirement to be able to remove a map from an ArcGIS Pro project using ArcPy.

However the ArcGISProject class does not seem to provide a method to do this.

I would like ArcPy to be enhanced to allow this.

My use case is a map automation application where I need to maintain three maps to support three MGA Zones (Australian "equivalent" to supporting three UTM Zones).  When the application exports a PDF at the end I also save a copy of the APRX so that the user wanting the PDF can, if need be, open up a copy of the project that created it (think of it as a draft), and perform some modifications before saving a final project/PDF.  Since each PDF only uses one of the MGA Zone maps I would like to unclutter the project before saving the copy by removing the other two MGA Zone maps.

Tags (3)
17 Comments
GeoNZ
by

I also have a requirement to be able to remove Layouts from an aprx using Arcpy.mp. Arcpro has simplfied map templates as you can now keep all template variations of paper size/orientation in one project file. The draw back is that when requiring just one layout of many, there is no way in arcpy.mp to strip out the unneeded layouts from the project.

ThomasL

ArcGIS Pro 2.3 is very slow with multiple Maps (and Layouts). 

We need this feature in arcpy to enable us to write clean-up scripts to help ArcGIS Pro running. 

MatthewWStelmach

We've encountered a bug when working on a scripting tool that has created multiple maps that are not visible in the catalog but listed when trying to export the APRX.  Without an arcpy module to delete the added map packages and not having them visible in the catalog we are unable to delete the added maps.

JTLancer

I am interested in this functionality as well. My use case is trying to interrogate mxd files from ArcPro  using the importDocument method.  So far I have not found a way to access arcpy.mp properties without first importing the map to a project.  I can import mxds just fine but there doesn't seem to be a way to programmatically get rid of them when desired after bringing them into the project.

 

 

JeffBarrette
Status changed to: In Product Plan

We hope to include a number of project item management functions (e.g., Delete, Copy, Add folder connections, database connections ,etc).

RichardHowe

@JeffBarrette That is great to hear! Removing and adding folder and database connections from a project would be so useful. All I seem to able to do at the moment is change the defaults

Any idea if this is coming soon??

JeffBarrette

We started to prototype removing project items recently.  Our current plan it to support this at Pro 3.1.

 

Jeff - Layout and arcpy.mp teams

RichardHowe

@JeffBarrette Thank you for taking the time to reply and keeping us informed. That's excellent news. I look forward to it!!

banders

@JeffBarrette +1 from me.  Also awaiting a method to remove a Map from an ArcGISProject.

John_Spence

@JeffBarrette +1 from us too! Would come in handy for a great number of situations.