Iterate and zoom to selections through index layer and export maps to PDF

614
4
Jump to solution
05-04-2021 02:45 PM
Labels (1)
monicawilliams
New Contributor II

Hello All,

I apologize if this question has been asked a dozen times. I have done a ton of research, but I feel like I am still in the rabbit hole. I am trying to create a Map Book using ArcGIS Pro and python. My goal is to iterate through my index layer, zoom to selection, export that selection to a PDF, and then append all those individual maps to a PDF. 

The way I am tackling this issue is to create GRID first, which is the code below:

#Part 1: Create Grid

#Import System Modules
import arcpy
from arcpy import env

#Set environment settings
arcpy.env.workspace = "C:\data\"

#Set local variables
outputFC = "Map Index"
inputFC "Sanborn_1920_AllBldgs"
polygonWidth = "139.2 meters"
polygonHeight = "153.7 meters"
numberRows = "3"
numberColumns = "5"
startingPageNum = "5"

#Execute GridIndex Features
arcpy.cartography.GRIDIndexFeatures(outputFC, inputFC, "INTERSECTFEATURE", "NO_USEPAGEUNIT", None, polyonWidth, polygonHeight, "", "", 3, 5, 7, "NO_LABELFROMORIGIN")

 

My next step is to loop through my table of contents, zoom to each selection, and make it its own map, and that is where I get confused. Does it make sense to use def zoom_export or arcpy.mapping module?

0 Kudos
1 Solution

Accepted Solutions
JeffBarrette
Esri Regular Contributor

Were you able to find the PDFDocument class help which includes a sample on how to append PDFs together?

 

https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/pdfdocument-class.htm

 

Jeff - arcpy.mp and Layout teams

View solution in original post

0 Kudos
4 Replies
curtvprice
MVP Esteemed Contributor

ArcGIS Pro doesn't have arcpy.mapping, I assume you mean arcpy.mp.

Seems to me rather than custom coding everything, you would be wise to use the Map Series functionality. Do you really need to automate the tile generation in Python? In my experience you usually want to tweak the map tile polygons before generating a map book.

 ArcGIS Pro Help: Map Series

0 Kudos
monicawilliams
New Contributor II

Sorry for the late reply. My goal was to create a custom script, but I am running into too many holes, so I am using Map Series and then tweaking my code to add my title page, Table of Content page, and overview pages. 

0 Kudos
JeffBarrette
Esri Regular Contributor

Were you able to find the PDFDocument class help which includes a sample on how to append PDFs together?

 

https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/pdfdocument-class.htm

 

Jeff - arcpy.mp and Layout teams

0 Kudos
monicawilliams
New Contributor II

Yes, thank you. The document was really helpful. 

0 Kudos