Summary
Instructions provided describe how to use a sample script to batch save map documents in ArcGIS 10.x as earlier document versions of ArcGIS.
Procedure
After migrating to another version of ArcGIS, older map documents are upgraded to the installed version the next time they are saved. To share the map documents with older ArcGIS clients, use the Save A Copy command from the ArcMap File menu to save each map document.
However, if there are many map documents involved, a Python script tool can be used to batch convert. Apply the following process to avoid opening each document.
Below is a sample Python script for saving map documents as earlier document versions of ArcGIS.
However, if there are many map documents involved, a Python script tool can be used to batch convert. Apply the following process to avoid opening each document.
Below is a sample Python script for saving map documents as earlier document versions of ArcGIS.
Follow us on:
subscribe to our channel
#######################################
import arcpy, sys, os, string
mxdList = string.split(arcpy.GetParameterAsText(0), ";")
outloc = arcpy.GetParameterAsText(1)
suffix = "_10.2"
version = arcpy.GetParameterAsText(2)
for item in mxdList:
item = item.strip('\'')
mxd = arcpy.mapping.MapDocument(item)
base = os.path.basename(item)
base = os.path.splitext(base)[0] + suffix + os.path.splitext(base)[1]
mxd.saveACopy(outloc + os.sep + base, version)
arcpy.AddMessage(os.path.basename(item) + " has been converted")
##########################################
- To run this sample script as a tool, paste the code above into a text editor and save as a .py file.
- Create a new custom toolbox.
- Right-click the toolbox and select Add > Script.
Add A New Script Tool
Follow us on:
subscribe to our channel
- In the wizard, name the tool, and click Next.
Name the Script Tool
- Navigate to the location of the .py file.
Browse to Python Script File
- Set the parameters for the Input MXDs and the Output Location. For the Input MXDsparameter, set MultiValue to Yes.
Set The First Two Parameters As Follows
- Set the parameter for the Output Version and add an Input List for the different versions so that the newest version in the list matches the version of the software. Click Finish.
Note: Using the version '10.1' option from version 10 does not work. The function can only save to the current or previous versions.
Setup a Version List to Choose From
- Double-click the Script tool to open and run it. Specify the input MXDs, output location, and output version. Click OK to run.
Open the Tool and Run It
No comments:
Post a Comment
Thanks for your comments