AnsweredAssumed Answered

ExporttoPNG Python for MapSeries

Question asked by eayarbe on Feb 25, 2019

I'm trying to export my ArcGIS Pro map series to PNG.  I'm using the MapSeries example code #2 from Esri (http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapseries-class.htm ).  I keep getting an Invalid page number error. 

 

Any help is much appreciated!!

 

See below code and error:

Code:

import arcpy, os, sys
relpath = "Z:\\41708.02 VAGuidehouse - MAHSO Call 1\\300TIG\\315Maps\\Maps_DDF"

aprx = arcpy.mp.ArcGISProject("CURRENT")
l = aprx.listLayouts()[0]
if not l.mapSeries is None:
ms = l.mapSeries
if ms.enabled:
for pageNum in range(1, ms.pageCount + 1):
ms.currentPageNumber = pageNum
print("layoutName{0}".format(ms.pageRow.Market))
pageName = ms.pageRow.Market
l.exportToPNG(relpath + "\\PNG_Test\\S7_MKTOVW_{0}".format(ms.pageRow.Market) + ".png")

 

 

Error:

Traceback (most recent call last):
File "<string>", line 10, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\arcobjects\_base.py", line 109, in _set
return setattr(self._arc_object, attr_name, cval(val))
ValueError: Invalid page number '1'.

 

 

Outcomes