PackageMap 示例(独立脚本)
查找位于指定文件夹中的所有地图文档,然后分别为这些地图文档创建地图包。
# Name: PackageMap.py
# Description: Find all the map documents that reside in a specified folder and create map packages for each map document.
# Author: ESRI
# import system modules
import os
import arcpy
from arcpy import env
# Set environment settings
env.overwriteOutput = True
env.workspace = "C:/arcgis/ArcTutor/Editing"
# Loop through the workspace, find all the mxds and create a map package using the same name as the mxd
for mxd in arcpy.ListFiles("*.mxd"):
print "Packaging " + mxd
arcpy.PackageMap_management(mxd, os.path.splitext(mxd)[0] + '.mpk', "PRESERVE", "CONVERT_ARCSDE", "#", "ALL")