I have followed the advice on the post How to automatically generate useful scales for data driven pages in ArcGIS desktop. I followed the advice, but when the process executes it was only the last value that is stored in all the fields in my column "
scale". However, I want each value saved in the ID of the appropriate polygon.
Here is the Code:
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\workspace\MyMXD.mxd") df = arcpy.mapping.ListDataFrames(mxd) for i in range(0, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = i if df.scale < 50: df.scale = 50 elif df.scale < 100: df.scale = 100 elif df.scale < 200: df.scale = 200 elif df.scale < 500: df.scale = 500 elif df.scale < 1000: df.scale = 1000 elif df.scale < 2000: df.scale = 2000 elif df.scale < 5000: df.scale = 5000 elif df.scale < 10000: df.scale = 10000 InTable = "C:\workspace\MyShapeFile.shp" with arcpy.da.UpdateCursor(InTable,["scale"]) as UpCur: for row in UpCur: row = df.scale UpCur.updateRow(row)