ExportToTIFF

サマリ

Exports the page layout or data frame of a map document (.mxd) to the Tagged Image File Format (TIFF).

説明

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 loss less compression techniques depending on file size and accuracy requirements. They are the best choice for importing into image editing applications across operating systems. However, they cannot be natively viewed by a web browser. ArcMap TIFFs exported from the data view also support georeferencing information in GeoTIFF tags or in a separate world file for use as raster data.

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.

World files are not generated for page layouts; a referenced data frame must be provided or the export will fail.

Refer to the Exporting your map topic in ArcGIS Help for more detailed discussions on exporting maps.

構文

ExportToTIFF (map_document, out_tiff, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, {tiff_compression}, {geoTIFF_tags})
パラメータ説明データ タイプ
map_document

A variable that references a MapDocument object.

MapDocument
out_tiff

A string that represents the path and file name for the output export file.

String
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.

(デフォルト値は PAGE_LAYOUT)

Object
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
color_mode

This value specifies the number of bits used to describe color.

  • 24-BIT_TRUE_COLOR24-bit true color.
  • 8-BIT_PALETTE8-bit palette.
  • 8-BIT_GRAYSCALE8-bit grayscale.
  • 1-BIT_MONOCHROME_MASK1-bit monochrome mask.
  • 1-BIT_MONOCHROME_THRESHOLD1-bit monochrome threshold.

(デフォルト値は 24-BIT_TRUE_COLOR)

String
tiff_compression

This value represents a compression scheme.

  • DEFLATEA lossless data compression.
  • JPEGJPEG compression.
  • LZWLempel-Ziv-Welch, a lossless data compression.
  • NONECompression is not applied.
  • PACK_BITSPack bits compression.

(デフォルト値は LZW)

String
geoTIFF_tags

If set to True, georeferencing tags are included in the structure of the TIFF export file. The tags contain pixel scale information and real-world coordinate information. These tags can be read by applications that support GeoTIFF format.

(デフォルト値は False)

Boolean

コードのサンプル

ExportToTIFF example 1

This script opens a map document and exports the page layout to a TIFF file using default values for all options.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
arcpy.mapping.ExportToTIFF(mxd, r"C:\Project\Output\Project.tif")
del mxd
ExportToTIFF example 2

This script will export a single data frame instead of the entire page layout, similar to exporting from data view in the ArcMap application. The default values for df_export_width and df_export_height are 640 and 480. By passing larger values for these parameters, we are able to produce an output image with higher detail. Setting geoTIFF_tags=True generates georeference information inside of the TIFF file header.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0]
arcpy.mapping.ExportToTIFF(mxd, r"C:\Project\Output\ProjectDataFrame.tif", df,
                           df_export_width=1600,
                           df_export_height=1200,
                           geoTIFF_tags=True)
del mxd

7/10/2012