HOW TO

Automate conversion of ArcMap MXDs to ArcGIS Pro APRX with Python

Last Published: October 4, 2024

Summary

This technical article provides a Python script that automates the conversion process from ArcMap map documents, MXDs, to ArcGIS Pro Project APRX format.

The conversion of map documents (.mxd) to ArcGIS Pro Projects (.aprx) could help organizations and individuals looking to migrate their projects to ArcGIS Pro in a batch process. This automation script simplifies and accelerates the conversion process, saving valuable time and effort. By streamlining the workflow, it ensures a smooth transition to ArcGIS Pro, enabling users to take advantage of Pro's enhanced features and improved performance.

Procedure

The Python script provided facilitates the conversion of multiple map documents (MXDs) to ArcGIS Pro Project format. By specifying the location of the MXDs, a blank ArcGIS Pro project, and the output folder for the .aprx files, the script iterates through each .mxd, creates a new .aprx file, for example, "New<MXD Name>.aprx", imports the .mxd into the project, and saves the final .aprx file. This automated approach eliminates the manual effort required for each conversion, making the migration process efficient and error-free.

Remember to customize the script parameters according to your specific file paths and project requirements for successful execution. After executing the script, open the newly created maps and layouts by navigating to ‘Maps’ and ‘Layouts’ item containers from Catalog Pane or Catalog View in Pro. 

import arcpy
import os
mxd1=r"C:\Users\RoshanA\Documents\Python Scripts\oldinp" #location of MXDs
arcpy.env.workspace = mxd1 
mxds = arcpy.ListFiles("*.mxd") #List of all mxds in the folder
for i in mxds: #iterating through the list of mxds
    newAprx=i[:-4]+".aprx"
    tempProject=r"C:\Users\RoshanA\Documents\Python Scripts\temp2\temp2.aprx" #A blank ArcGIS Project without any elements
    newPath=r"C:\Users\RoshanA\Documents\Python Scripts\New" #(Path for creating ArcGIS Pro Projects)\New
    x=newPath+newAprx #Concatenating path for new project and the name of the project
    aprx=arcpy.mp.ArcGISProject(tempProject) #Assigning the blank project as our current Project
    aprx.saveACopy(x) # saving a copy to generate the output project
    aprx.importDocument(mxd1+"//"+i) #importing the corresponding mxd
    aprx.saveACopy(x) # Saving the project after importing map

Article ID: 000033590

Software:
  • ArcMap
  • ArcGIS Pro

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options