I need to find a way to reclassify/refresh graduated color symbology in between exporting data driven pages.
Background: I have spatially joined Block Groups (BGs) to 1000 facilities (and facility ID) within 10 miles. There are multiple instances of the same BGs because they are located in close proximity to multiple facilities.
I prefer to use the standard deviation classification method. Currently, when Data Driven Pages are enabled and I classify the data - the value ranges are applied are relevant to what is displayed (this is good). The problem arises when I toggle to the next page and this is not re-calculated, but rather continues to use the value ranges for the previously displayed BGs.I cannot display all at once, because the multiple occurrences overlap. Also, for one particular facility a BG might represent a lower value while for another the same BG might represent a larger value.
I export data driven pages in very basic python script. One answer would be to insert code that applies symbology from a different layer before exporting the page. This process works manually in Arcmap: Apply Symbology > refresh > export page...etc. I have limited experience with python, and the 2nd to last line I have added below isn't making it happen (but works in a separate script).
This is the python I am currently working with:
import arcpy mxd = arcpy.mapping.MapDocument(r"E:\Templates_MXD\BU_5Mile.mxd") export_path = r"C:\Users\sder\Desktop\Test\\" field_name = "ID" df = arcpy.mapping.ListDataFrames(mxd, "Business Analyst Map") updateLayer = arcpy.mapping.ListLayers(mxd, "BKtoBG", df) sourceLayer = arcpy.mapping.Layer(r"E:\Templates_Layer\BKtoBG.lyr") for i in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = i row = mxd.dataDrivenPages.pageRow print row.getValue(field_name) arcpy.mapping.ExportToPDF(mxd, export_path + row.getValue(field_name) + ".pdf", resolution=200, image_quality="BETTER") arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer,True) del mxd