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...
Solved! Go to Solution.
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?
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.
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
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?
I don't know why I read that as exporting to PDF! Just what I'm used to doing, I guess.