From 9f8165756f23dc58d8a725d135fac7606decaa90 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Fri, 3 Aug 2018 10:21:56 +1000 Subject: [PATCH] Iterate through data driven pages correctly --- plot_heatmaps.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plot_heatmaps.py b/plot_heatmaps.py index d868c14..6258ec8 100644 --- a/plot_heatmaps.py +++ b/plot_heatmaps.py @@ -113,13 +113,13 @@ def process(yaml_name): # Activate data driven pages ddp = mxd.dataDrivenPages - # Export to jpg - for output_dir in output_dirs: - page_name = ddp.pageRow.Beach - jpg_name = os.path.join(output_dir, page_name + '.jpg') + for page_num in range(1, ddp.pageCount + 1): + ddp.currentPageID = page_num - arcpy.mapping.ExportToJPEG( - mxd, jpg_name, resolution=200, jpeg_quality=80) + # Export beaches that are covered by current survey + if ddp.pageRow.Parent == beach.lower(): + page_name = ddp.pageRow.Beach + jpg_name = os.path.join(output_jpg_dir, page_name + '.jpg') def main():