Select to view content in your preferred language

Map Series Arcpy- help needed

635
1
03-16-2018 10:30 AM
TheodoreF
Frequent Contributor

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"))‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Tags (1)
0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

I would start with 

print("layouts listed {}".format(l))

And see what is next with

print("m enabled {}".format(m.enabled))

You have to print useful information to test