Available with Production Mapping license.
Summary
Exports the page layout or data frame of an .mxd to separate Tagged Image File Format (TIFF) files based on color mapping settings.
Discussion
TIFF files are the most versatile raster format. TIFFs can store pixel data at several bit depths and can be compressed with either lossy or lossless compression techniques depending on file size and accuracy requirements.
Maps can be exported to 1-bit TIFF format, color-separated files based on the unique list of colors defined in symbols that appear in the data frame and page layout. For more information on styles and choosing colors, see ArcGIS for Desktop help.
The defined colors and their parameters can be set up and exported to an ECT file. This ECT file can then be loaded by any system using the TIFF Color Separator. In this way, a color definition file can be set up for different production workflows. This color file can then be distributed for use during the color separation process. Tools for loading and saving color files help with this process.
To export a single data frame instead of the entire page layout, pass a DataFrame object to the function's data_frame parameter. Because data frame exports do not have an associated page to provide height and width information, you must provide this via the df_export_width and df_export_height parameters.
Controlling graphic quality of the generated image differs for page layout exports versus data frame exports. When exporting a page layout, control image detail by changing the resolution parameter. When exporting a data frame, keep the resolution parameter at its default value, and change the df_export_width and df_export_height parameters to alter image detail. The height and width parameters directly control the number of pixels generated in the export file and are only used when exporting a data frame. Images with larger numbers of pixels will have higher image detail. For most page layout exports, the default parameter values should generate good results and nice looking export images on the first try. For data frame exports, you may need to experiment with the df_export_width and df_export_height values a few times before getting the result you want.
Refer to Exporting to Separated TIFF in ArcGIS for Desktop help for more detailed discussions on exporting maps.
Syntax
ExportToSeparatedTIFF (map_document, out_tiff_path, settings_file, {file_format}, {compression}, {invert_plates}, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {root_filename})
Parameter | Explanation | Data Type |
map_document | A variable that references a MapDocument object. | MapDocument |
out_tiff_path | A string that represents the path to the directory where the separated TIFF files will be created. | String |
settings_file | The path to an Esri Color Table (ECT) file that contains the color mapping settings to be used when the TIFF is generated. | String |
file_format | Indicates the format in which the color files are exported.
(The default value is ONE_BIT_SEPARATES) | String |
compression | Indicates what compression method is used to encode the image.
(The default value is CCITT_GROUP_4_FAX) | String |
invert_plates | Indicates whether the output values are toggled between positive and negative values for the exported TIFF files. This is only supported with one-bit and eight-bit separates. (The default value is False) | Boolean |
data_frame | A variable that references a DataFrame object. Use the string/constant PAGE_LAYOUT to export the map document's page layout instead of an individual data frame. (The default value is PAGE_LAYOUT) | DataFrame |
df_export_width | A number that defines the width of the export image in pixels for a data frame export; df_export_width is only used when exporting a data frame. Exporting a page layout uses the map document page width instead of df_export_width. (The default value is 640) | Integer |
df_export_height | A number that defines the width of the export image in pixels for a data frame export; df_export_width is only used when exporting a data frame. Exporting a page layout uses the map document page width instead of df_export_width. (The default value is 480) | Integer |
resolution | A number that defines the resolution of the export file in DPI (dots per inch). (The default value is 96) | Integer |
world_file | If set to True, a georeferenced world file is created. The file contains pixel scale information and real-world coordinate information. (The default value is False) | Boolean |
root_filename | The root file name for each TIFF. The TIFF file name includes the RGB information for the color and can be modified to include the map name, for example, SoCal_UTM_Map_RGB_0_0_0. If no file name is defined, the color is exported as RGB_X_X_X, where X is the red, green, or blue value for the color. (The default value is None) | String |
Code sample
ExportToSeparatedTIFF example 1
This script exports a map to a separated TIFF using the required parameters and default settings for the optional parameters.
import arcpy
import arcpyproduction
# Check out Production Mapping extension
arcpy.CheckOutExtension("foundation")
# Define variables
mxd = arcpy.mapping.MapDocument(r"C:\Project\MXDs\Project.mxd")
out = r"C:\Project\sep_TIFFs"
settings = r"C:\Project\ect\all_colors.ect"
# Run ExportToSeparatedTIFF with only required parameters
arcpyproduction.mapping.ExportToSeparatedTIFF(mxd, out, settings)
# Check in extension
arcpy.CheckInExtension('foundation')
ExportToSeparatedTIFF example 2
This script exports the same map twice using different settings files. Visibility is set to False for two layers before export.
import os
import arcpy
import arcpyproduction
# Check out Production Mapping license
arcpy.CheckOutExtension("foundation")
# Define variables
mxd = arcpy.mapping.MapDocument(r"C:\Project\MXDs\Project.mxd")
out = r"C:\Project\tiffs"
settings = [r"C:\Project\ect\TopoMap.ect", r"C:\Project\ect\USGS.ect"]
df = arcpy.mapping.ListDataFrames(mxd)[0]
# Change visibility of layers
for lyr in arcpy.mapping.ListLayers(mxd, "", df):
if lyr.name.lower() in ["contourl" or "openwatera"]:
lyr.visible = False
# Loop through settings files and export map
for i in range(len(settings)):
project_name = os.path.basename(settings[i]).split(".")[0]
arcpyproduction.mapping.ExportToSeparatedTIFF(
mxd, out, settings[i], root_filename="project_{0}".format(project_name))
# Check in extension
arcpy.CheckInExtension('foundation')