I would like to create a python script that will zoom into each county in a state shapefile and export a pdf map. I have found two DataFrame methods, panToExtent and zoomToSelectedFeatures. I don't want to use panToExtent because I want it to zoom to the shape of the county. My code uses the zoomToSelectedFeatures but i'm not exactly sure how to select features
. This is what my code looks like so far. Thanks for the help!import arcpy mxd = "C:/ArcPyTests/Untitled.mxd" mapdoc = arcpy.mapping.MapDocument(mxd) counties = "C:/ArcPyTests/countyPopulation.shp" rows = arcpy.SearchCursor(counties) output = "C:/ArcPyTests/" df = arcpy.mapping.ListDataFrames(mapdoc) for row in rows: mapdoc.extent = row.Shape.extent df.zoomToSelectedFeatures(mapdoc.extent) outputname = row.County arcpy.mapping.ExportToPDF (mapdoc, outputname + ".PDF") print "Output " + outputname + " complete" del mapdoc