[GIS] How to Prevent Data Driven Pages From Hanging on Subsequent Export

arcgis-10.3arcgis-desktopdata-driven-pagesexport

I am working in ArcMap 10.3.0 and exporting through Data Driven Pages (DDP). The DDP export works as expected the first time and for immediate subsequent exports, but if I use DDP to export again after more than a minute or so (the time varies) from the same MXD, the program hangs and I have to shut it down through the Task Manager.

I can tell if it is going to hang up as soon as I click "Export" because the Export window does not show "Page x of x" text. See screenshots here: https://geonet.esri.com/message/536459#536459. Even if I let the computer run for awhile, the "Page x of x" text never appears and the export does not happen. This only happens on subsequent exports after more than a minute from an MXD.

This seems to happen whether I export a single page or the entire document the first time. However if I resave the MXD with a new name and then export, it always hangs up and requires ArcMap to be restarted. The problem seems to occur whether I am creating a new PDF file or overwriting an existing PDF file.

Other information:

  • My map consists of an ESRI aerial basemap (no other raster layers), with five 10000' x 10000' lidar contour shapefiles and about 10 other small vector shapefile layers.
  • My export settings are: 300 dpi resolution & output image quality/resample ratio 1:2.
  • I am working from a data server located in this building, but the connection speed varies.
  • Another co-worker is having the same problems with the same MXDs on his machine.

Edited to add this error message: It appeared after ArcMap was hung up on a subsequent export, and hit "end task" in the Task Manager. This is only the 2nd or 3rd time I've gotten this error message, but I thought it might be relevent. (Also, I don't have an f:/ drive as shown in the error message.)

enter image description here

Someone else had this problem as asked on GeoNet here: https://geonet.esri.com/thread/161564
No solutions were presented to her question so I wanted to ask again here.

Is there any way to prevent ArcMap hanging up on a subsequent DDP export?

Edited to add this code snippet, which produces multiple exports without hanging:

import_path = r"R:\Projects\Project\GIS\MXDs\Project_property_maps.mxd"   # Path of .mxd
export_path = r"C:\Users\user\Desktop\test\Test"   # Path of output file
field_name = "Project_INDEX.Pg_num" # Name of field used to sort DDP
pg_name = "Project_INDEX.Desc_" # Name of field used in PDF file name

mxd = arcpy.mapping.MapDocument(import_path) 
for i in range(1, mxd.dataDrivenPages.pageCount + 1):
   mxd.dataDrivenPages.currentPageID = i
   row = mxd.dataDrivenPages.pageRow
   print row.getValue(field_name)
   arcpy.mapping.ExportToPDF(mxd, export_path + row.getValue(pg_name) + ".pdf") 
del mxd

Best Answer

Based on comments from @Adam, I used a Python script to export my Data Driven Pages MXD with no problems with hanging on subsequent exports. Using Python for the exports appears to have solved the problems I was having.

I used the following script which I added to an ArcMap Toolbox as a script. (The script will only run through Toolbox, since there are parameters included.)

#Set Input Parameters
mxd = arcpy.GetParameterAsText(0) 
PDFpath = arcpy.GetParameterAsText(1) 
PDFname = arcpy.GetParameterAsText(2)

#Create an MXD object
mxd_doc = arcpy.mapping.MapDocument(mxd) 

#Export to DDP 
ddp = mxd_doc.dataDrivenPages 
ddp.exportToPDF(PDFpath + r"\\" + PDFname + ".pdf", "ALL") 
del mxd, mxd_doc, PDFname, PDFpath

I would like to further modify my script to be able to specify which pages should be exported (instead of defaulting to "ALL") but this works sufficiently for what I need now.

Related Question