I have little experience with python. I'm using ArcGIS 10.4. I'm attempting to create pdfs of layouts in which polygon features are symbolized with the same colors for classes, but the assignments change in each of 1,000 fields in the feature class. That is, I want to loop through each field (00000, 00001, 00002...), symbolize the categories (1-13) as set up in a .lyr file, change the map title to match the field name, print a pdf of the layout, & move to the next field to do it again.
What I have will have to change is the map title & print the pdf with the title. The problem is every map is the same, except for the title. The polygons aren't given symbology according to the .lyr file, they're identical to the .lyr file.
I don't think it should matter, but the shapefile I'm symbolizing has 2692 rows. I need to display one field at a time, with each polygon (row) in the field shaded a specific color, depending on it's value, 1-13. Clarification:(Actually, there will be many rows of each class 1-13. Each row with a particular value gets the same color)
I've been asked to clarify the question. Yes, I want to generate 1000 pdfs, one for each field in a feature class, each with a title corresponding to the field name. The legend should stay the same. The colors for class 1, class 2, class 3, etc. should stay the same (they're defined by RGB values).
What I have:
import arcpy import os mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*") featureclass = arcpy.mapping.ListLayers(mxd, "*", df) symbologyLyr = arcpy.mapping.Layer(r"\\path\Maps\SymbologyShp.lyr") field_names = [f.baseName for f in arcpy.ListFields(featureclass)] for f in field_names: if f.startswith("Map"): arcpy.mapping.UpdateLayer(df, featureclass, symbologyLyr, True) TextElement = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "MapTitleText") TextElement.text = f arcpy.mapping.ExportToPDF(mxd, r"\\path\outputPDF\Map_" + f)