Select to view content in your preferred language

Data Driven Pages

3784
4
Jump to solution
05-23-2015 02:31 AM
MANESK
by
Occasional Contributor

Hi,

I need to export around 150 .tiffs from a .mxd using Data driven pages based on Index grid automatically using Python script. Pls share your ideas...

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

You may want to provide some insight in the version of ArcMap you are working with, since sometimes functionality might be different depending the version.

If you look at the sample provided at the end of the Help:  Exporting Data Driven Pages—Help | ArcGIS for Desktop :

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
  mxd.dataDrivenPages.currentPageID = pageNum
  arcpy.mapping.ExportToPNG(mxd, r"C:\Temp\ParcelAtlas_Page" + str(pageNum) + ".png")
del mxd

Since this sample uses PNG as output format you will also want to check out the Help on: ExportToTIFF—Help | ArcGIS for Desktop

arcpy.mapping.ExportToTIFF(mxd, out_tiff, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, {tiff_compression}, {geoTIFF_tags})

Obviously, this will only work if you have set up your data driven pages correctly. And if you have your DDP set up correctly, you actually don't need code to export the result...

So... why do you need python code to export the DDP to TIFF?

View solution in original post

4 Replies
DanPatterson_Retired
MVP Emeritus

Did you get through the tutorial on data access mapping? Kind of a wide open question as it stands since we have no idea what you know about the topic or what problems you have found.

0 Kudos
SepheFox
Frequent Contributor

Hey Manu, straight from the help files, the syntax is:

exportToPDF (out_pdf, {page_range_type}, {page_range_string}, {multiple_files}, {resolution}, {image_quality}, {colorspace}, {compress_vectors}, {image_compression}, {picture_symbol}, {convert_markers}, {embed_fonts}, {layers_attributes}, {georef_info}, {jpeg_compression_quality}, {show_selection_symbology})

Have you tried this yet? Has it given any problems? If you don't understand the parameters, you can look at the help file: ArcGIS Help 10.1

0 Kudos
XanderBakker
Esri Esteemed Contributor

You may want to provide some insight in the version of ArcMap you are working with, since sometimes functionality might be different depending the version.

If you look at the sample provided at the end of the Help:  Exporting Data Driven Pages—Help | ArcGIS for Desktop :

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
  mxd.dataDrivenPages.currentPageID = pageNum
  arcpy.mapping.ExportToPNG(mxd, r"C:\Temp\ParcelAtlas_Page" + str(pageNum) + ".png")
del mxd

Since this sample uses PNG as output format you will also want to check out the Help on: ExportToTIFF—Help | ArcGIS for Desktop

arcpy.mapping.ExportToTIFF(mxd, out_tiff, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, {tiff_compression}, {geoTIFF_tags})

Obviously, this will only work if you have set up your data driven pages correctly. And if you have your DDP set up correctly, you actually don't need code to export the result...

So... why do you need python code to export the DDP to TIFF?

SepheFox
Frequent Contributor

I don't know why I read that as exporting to PDF! Just what I'm used to doing, I guess.

0 Kudos