AnsweredAssumed Answered

ArcPy: Data Driven Pages to Individual Map Packages

Question asked by Playa on Jan 20, 2016
Latest reply on Jan 23, 2016 by Dan_Patterson

I came across the following sample code that Chris Fox from esri wrote as a way to create a new mxd for each Data Driven Page:


mxdPath = r"C:\Project\DDPMap.mxd"
mxd = arcpy.mapping.MapDocument(mxdPath)
mxdDir = os.path.dirname(mxdPath)
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    mxdName = os.path.join(mxdDir, "DDPMap", + str(pageNum) + ".mxd")
del mxd


Is there  a way to create a map package for each Data Driven Page instead of having to save it out first as a new mxd.


arcpy package map sample:


for mxd in arcpy.ListFiles("*.mxd"):
    arcpy.AddMessage("Packaging: {}".format(mxd))
    arcpy.PackageMap_management(mxd, os.path.splittext(mxd) [0] + ".mpk", "PRESERVE", "CONVERT_ARCSDE", "DISPLAY", "ALL")