Select to view content in your preferred language

Exporting graphic files

279
0
07-31-2020 09:53 AM
MarkBalman
Frequent Contributor

Hi all

Running ArcGIS Pro 2.5.1

When running an export python script as follows:

import arcpy
import os
import sys

if not hasattr(sys, 'argv'):
sys.argv = ['']

relpath = os.path.dirname(sys.argv[0])
p = arcpy.mp.ArcGISProject(relpath + "C:/tmp/5cm_2020.aprx")
l = p.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("Exporting {0}".format(ms.pageRow.Sciname))
pageName = ms.pageRow.Sciname
l.exportToPNG(relpath + "C:/tmp/Graphics/{0}".format(ms.pageRow.name+ ".png"))

Generally this works as well as expected but am seeing that some files have been exported that are missing data, as if the layout has not finished drawing but exported anyway. Is there something I am missing or has anyone experienced this? I am attempting to output over 11,000 files and manually checking to see if they are correct is a daunting prospect.

Many thanks,

Mark

0 Kudos
0 Replies