ExportToSeparatedTIFF (arcpyproduction.mapping)

摘要

Exports the page layout or data frame of an .mxd to separate Tagged Image File Format (TIFF) files based on color mapping settings.

讨论

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.

要导出单个数据框(而不是整个页面布局),可将 DataFrame 对象传给函数的 data_frame 参数。由于数据框导出不具有可提供高度和宽度信息的关联页面,所以必须通过 df_export_widthdf_export_height 参数来提供此信息。

对于页面布局导出和数据框导出,控制生成图像图形质量的方式有所不同。导出页面布局时,通过更改 resolution 参数来控制图像细节。导出数据框时,保持 resolution 参数的默认值,更改 df_export_widthdf_export_height 参数来更改图像细节。高度和宽度参数直接控制在导出文件中生成的像素数,且仅在导出数据框时使用。像素数较高的图像具有较高的图像细节。对于大多数页面布局导出,默认参数值应在第一次尝试时生成良好的结果和美观的导出图像。对于数据框导出,您可能需要对 df_export_widthdf_export_height 值进行若干次试验,之后才能得到理想的结果。

Refer to Exporting to Separated TIFF in ArcGIS for Desktop help for more detailed discussions on exporting maps.

注注:

File sizes can differ when map documents are exported using arcpyproduction.mapping instead of the ArcMap commands. This is due to the differences in the functions in the Python module versus the commands in ArcMap.

语法

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})
参数说明数据类型
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.

  • COMPOSITE_TRUE_COLORExports the image without color mappings.
  • EIGHT_BIT_SEPARATESExports the image using 8-bit color separates, where one color mapping is created for colors based on similar RGB values. White is excluded from the mappings.
  • ONE_BIT_SEPARATESExports the image using 1-bit color separates, where one color mapping is created for each color in the map. This is the default value.

(默认值为 ONE_BIT_SEPARATES)

String
compression

Indicates what compression method is used to encode the image.

  • NONENo compression is applied.
  • PACKBITSThe PackBits compression, which is supported for one-bit and eight-bit separates.
  • CCITT_GROUP_4_FAXA compression that is only valid for one-bit separates. This is the default value.

(默认值为 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.

(默认值为 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.

注注:

This parameter is required if you define the world_file parameter.

(默认值为 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.

(默认值为 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.

(默认值为 480)

Integer
resolution

A number that defines the resolution of the export file in DPI (dots per inch).

(默认值为 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.

(默认值为 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.

(默认值为 None)

String

代码实例

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')

相关主题

4/27/2014