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_width и df_export_height.

Управление качеством графики сгенерированного изображения при экспорте компоновки страницы отличается от экспорта фрейма данных. При экспорте компоновки страницы детализация изображения управляется параметром resolution. При экспорте фрейма данных оставьте значение параметра resolution по умолчанию, и измените параметры df_export_width и df_export_height, чтобы изменить детализацию изображения. Параметры высоты и ширины напрямую управляют числом пикселей, генерирующихся в файле экспорта, и используются только при экспорте фрейма данных. Изображения с большим числом пикселей имеют большую детализацию. При экспорте большинства компоновок значения параметров, использующиеся по умолчанию, позволяют получить хорошие результаты и качественные изображения с первой попытки. При экспорте фрейма данных необходимо попробовать различные значения параметров df_export_width и df_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