AnsweredAssumed Answered

Trouble iterating through a table, setting map frame extent to row, and importing a PDF

Question asked by jake.johnson_SPIMAPS on Jul 16, 2019
Latest reply on Jul 17, 2019 by jake.johnson_SPIMAPS

Hi,

 

I'm trying to take a table of polygons that split my physical area of interest into 700 chunks. I'm tasked with taking each section and putting it into a layout for making backup paper maps. The layout is no problem, it's the automating of showing the selected section in the map frame that is not working for some reason. I'm new to ArcPy but my research so far seems to point to arcp.da.SearchCursor as the class to carry this out. Like so:

 

import arcpy

aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps("Maps*")[0]
lyt = aprx.listLayouts("Layout*")[0]
lyr = m.listLayers("Layer*")[0]
mf = lyt.listElements("mapframe_element", "MapFrame*")[0]
fc = "Sections"
field = "OBJECTID"

with arcpy.da.SearchCursor(fc, field) as cursor:
   for row in cursor:
      mf.camera.setExtent(mf.getLayerExtent(lyr/row?, True, False)
      # and then here I would save to PDF
del row, cursor

 

Judging by my code so far, I think I'm trying to zoom into the wrong thing and that something else is missing. I'm using ArcGIS Pro 2.4.0. Appreciate any assistance, thanks!

Outcomes