AnsweredAssumed Answered

Map Series Arcpy- help needed

Question asked by terrafirma_theo on Mar 16, 2018
Latest reply on Mar 16, 2018 by Dan_Patterson

ArcGIS Pro Hi, I have a script which is meant to export 10 or so Map Series pages to seperate PDFs. PDFs are to be named by page number.

However, the script runs through to the end without exporting any PDFs. All I get is the two print commands upon completion.

-MapSeries is enabled in the Project.

-I have all appropriate permissions.

Any ideas? I used the example script from: MapSeries—ArcPy | ArcGIS Desktop  to help me.

import arcpy, os, sys
relpath = os.path.dirname(sys.argv[0])

p = arcpy.mp.ArcGISProject("C:\\Users\\Tom\\Documents\\GIS_Tasks\\General_tasker\\General_tasker.aprx")
print ("project located")
l = p.listLayouts()[0]
print ("layouts listed")
if not l.mapSeries is None:
  ms = l.mapSeries
  if ms.enabled:
    for pageNum in range(1, ms.pageCount + 1):
      ms.currentPageNumber = pageNum
      print("Exporting page {0} of {1}".format(str(ms.currentPageNumber), str(ms.pageCount)))
      l.exportToPDF("C:\\Users\\Tom\\Dropbox\\Production\\Internal Automation\\Assess_automation\\Current_assess_site_plans\\Assess_{0}".format(str(ms.currentPageNumber) + ".pdf"))

 

 

Outcomes