Guest User

Untitled

a guest
Oct 22nd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. import arcpy, os
  2.  
  3. ws = r"C:temp"
  4. map_folder = os.path.join(ws, "maps")
  5. pdf_folder = os.path.join(ws, "pdfs")
  6.  
  7. arcpy.env.workspace = map_folder
  8. arcpy.env.overwriteOutput = True
  9.  
  10. # generate list of map documents in folder to loop through
  11. map_list = arcpy.ListFiles("*.mxd")
  12.  
  13. ###
  14. def exportAISMap(mxd_path, out_path):
  15. mxd = arcpy.mapping.MapDocument(mxd_path)
  16. # arcpy.mapping.ExportToJPEG(mxd, out_path)
  17. # arcpy.mapping.ExportToPNG(mxd, out_path)
  18. arcpy.mapping.ExportToPDF(mxd, out_path)
  19. print "Exported map file: " + str(out_path) + "n"
  20. # mxd.save()
  21. del mxd
  22. ###
  23.  
  24. print "Saving out " + str(len(map_list)) + " map documentsn"
  25.  
  26. for map_file in map_list:
  27. print map_file
  28.  
  29. mxd_path = os.path.join(map_folder, map_file)
  30.  
  31. pdf_file = map_file.replace(".mxd", ".pdf")
  32. pdf_path = os.path.join(pdf_folder, pdf_file)
  33.  
  34. exportAISMap(mxd_path, pdf_path)
  35.  
  36. from multiprocessing import process
  37.  
  38. exportAISMap(mxd_path, pdf_path)
  39.  
  40. p = Process(target = exportAISMap, args = (mxd_path, pdf_path))
  41. p.start()
  42. p.join()
Add Comment
Please, Sign In to add comment