New to Python.
I have an mxd file file with three layers and one is a layer of elementary school boundaries.
Goal: Make a pdf doc with a page for each elementary boundary.
- arcpy.SelectLayerByAttribute_management(Counties, "NEW_SELECTION", "Boundary = 'PineCone'")
- Next boundary polygon
- Append PDF
My question: Do I need to make a physical file of the elementary boundary layer before I can “SelectLayerByAttribute” for each boundary? Or is there a way to loop through the boundaries by making the selections straight from the mxd file.Below is not complete code, just the thought process.
import arcpy from arcpy.mapping import * mapDoc = MapDocument(r"C:temp\boundary.mxd") pdfElementary = r”C:\Temp\Elem_Bndries” ??? ??? for bname in boundaryList arcpy.SelectLayerByAttribute_management(Counties, "NEW_SELECTION", "boundary = bname") ExportToPDF (mapDoc, pdfElementary, "PAGE_LAYOUT") pdfFinalBoundary = appendPages(pdfElementary) pdfFinalBoundary .saveAndClose () del pdfFinalBoundary