[GIS] Reducing time for Export to PDF (or any other alternative to print maps) in ArcPy

arcpyexportpdfperformance

For my work, I designed a tool to create PDF maps with large amount of data, intersected with 5 buffer rings using ArcPy. The job involves intersecting points, selecting points, generating Elevation for the points and distance from the order location (the centre of the buffers). The job works fine for single map and takes only 2-3 minutes.

But some other requirements came up and now I am appending two more PDF to the original PDF but with different extents based on the ring radii. The job is taking as long as 8-9 minutes. If I create mapbook with data driven pages, it is not that slow. I have tried different resolution, it is somewhat efficient with less dpi but project manager is not happy about it. We are using 400 dpi instead of default 300 dpi. Also, Layers and attributes both are required for reports- though that change did not effect time that much. The scaling of tool is unknown too. The original design was meant for 1000 times uses in one month, but business is launching in another jurisdiction, so not sure about the number of uses down the road. And with more uses and longer run time- the tool will be running into 'Execution of job XXX failed because of crash or termination of the server object.' regardless of ArcGIS service time change.

Has anyone used another PDF generation tool with in Python to generate maps?

if (country.lower()== 'xy'):
            scale = df.scale * 1.1
            df.scale = ((int(scale)/100)+1)*100
            MainTitleTextElement.text= "Map : "+ Buffer4 + " Mile Radius"
            outputLayoutPDF4 = os.path.join(scratch, 'mapExport4.pdf')
            arcpy.mapping.ExportToPDF(mxd, outputLayoutPDF4, "PAGE_LAYOUT", 640, 480, 400, "FASTER", "RGB", True, "ADAPTIVE", "RASTERIZE_BITMAP", False, True, "LAYERS_AND_ATTRIBUTES", True, 90) 
            scale = df.scale * 1.1
            df.scale = ((int(scale)/100)+1)*100
            MainTitleTextElement.text= "Map : "+ Buffer3 + " Mile Radius"
            outputLayoutPDF3 = os.path.join(scratch, 'mapExport3.pdf')
            arcpy.mapping.ExportToPDF(mxd, outputLayoutPDF3, "PAGE_LAYOUT", 640, 480, 400, "FASTER", "RGB", True, "ADAPTIVE", "RASTERIZE_BITMAP", False, True, "LAYERS_AND_ATTRIBUTES", True, 90)        
            outputPDF.appendPages(outputLayoutPDF4)
            outputPDF.appendPages(outputLayoutPDF3)          

Best Answer

I suggest expending effort cutting down the drawing time of the mxd rather than focusing on the python export process. There's some information about that here:

Esri KB 34043 - HowTo: Improve printing or exporting performance

Related Question