Skip to main content
fixed typo in code
Source Link
Cindy Jayakumar
  • 4.1k
  • 7
  • 39
  • 75

To ensure that the correct scale is used (in my case, the scales are valued stored in a field scale_field), the following code is added to the for loop which exports all the maps (the input document must have Data Driven Pages Enabled):

#some code here
mxd = arcpy.mapping.MapDocument(inputMapDoc)
df = arcpy.mapping.ListDataFrames(mxd)[0] #using the 1st data frame
for i in range(1, mxd.dataDrivenPages.pageCount + 1):
      mxd.dataDrivenPages.currentPageID = i
      df.scale = mxd.dataDrivenPages.pageRow.getValue(“scale_field”scale_field)

To ensure that the correct scale is used (in my case, the scales are valued stored in a field scale_field), the following code is added to the for loop which exports all the maps (the input document must have Data Driven Pages Enabled):

#some code here
mxd = arcpy.mapping.MapDocument(inputMapDoc)
df = arcpy.mapping.ListDataFrames(mxd)[0] #using the 1st data frame
for i in range(1, mxd.dataDrivenPages.pageCount + 1):
      mxd.dataDrivenPages.currentPageID = i
      df.scale = mxd.dataDrivenPages.pageRow.getValue(“scale_field”)

To ensure that the correct scale is used (in my case, the scales are valued stored in a field scale_field), the following code is added to the for loop which exports all the maps (the input document must have Data Driven Pages Enabled):

#some code here
mxd = arcpy.mapping.MapDocument(inputMapDoc)
df = arcpy.mapping.ListDataFrames(mxd)[0] #using the 1st data frame
for i in range(1, mxd.dataDrivenPages.pageCount + 1):
      mxd.dataDrivenPages.currentPageID = i
      df.scale = mxd.dataDrivenPages.pageRow.getValue(scale_field)
Source Link
Cindy Jayakumar
  • 4.1k
  • 7
  • 39
  • 75

To ensure that the correct scale is used (in my case, the scales are valued stored in a field scale_field), the following code is added to the for loop which exports all the maps (the input document must have Data Driven Pages Enabled):

#some code here
mxd = arcpy.mapping.MapDocument(inputMapDoc)
df = arcpy.mapping.ListDataFrames(mxd)[0] #using the 1st data frame
for i in range(1, mxd.dataDrivenPages.pageCount + 1):
      mxd.dataDrivenPages.currentPageID = i
      df.scale = mxd.dataDrivenPages.pageRow.getValue(“scale_field”)