MapFrame

摘要

MapFrame 对象是一个页面布局元素,可用于在布局上显示地图内容。同时还用于访问页面大小和定位、基本导航方法以及导出选项。

说明

MapFrame 是一个布局元素,用于显示添加到地图的地理信息。同时还用于在布局上控制其本身的大小与定位。多个 MapFrame 可同时引用同一 Map

Layout 对象上的 listElements 函数用于返回 MapFrame 对象。通过提供 element_typeMAPFRAME_ELEMENT,您可以仅返回 MapFrame 元素。您还可以通过提供 wildcard 进一步优化过滤器。有必要确保每个地图框均具有唯一的名称,这样便可使用 name 属性轻松对其进行引用。

引用 MapFrame 后,您可以使用 map 属性获取其相关地图,这样您便可以在地图上管理图层、访问地图标签以及进行更多操作。更重要的是您可以更改正在引用 MapFrameMap 对象。您可以切换相同维度或不同维度的地图。如果您要更改地图的维度,则首先必须更改 MapViewer 对象上的 type 属性。例如,如果 Camera modeMAP(针对 2D),则您必须将mode更改为 LOCALGLOBAL(针对 3D)。执行此操作后,您可以将地图从 2D 更改为 3D。

camera 属性将返回对 Camera 对象的引用。Camera 用于控制数据在地图框中显示的位置和查看位置。用于控制 2D 地图的比例和范围等项目,以及 3D 地图的照相机位置信息。

有必要了解导航方法及其在地图 (2D) 和场景 (3D) 地图框之间的工作方式。如果将使用范围的 2D 地图、书签或方法应用到 3D 地图框,则结果将返回数据的平面视图。getLayerExtentpanToExtentzoomToAllLayers 将始终生成平面视图。zoomToBookmark 方法用于在 3D 地图框之间进行工作时维护 3D 视图,但是将 2D 书签用于 3D 地图框或相反情况,结果将是地图框数据的平面视图。

elementPositionXelementPositionY 参数取决于元素的锚点位置。

属性

属性说明数据类型
camera
(可读写)

照相机用于控制数据在地图框中显示的位置和查看位置。

Camera
elementHeight
(可读写)

页面布局上的地图框高度。 分配或报告的单位为页面单位。

Double
elementPositionX
(可读写)

地图框的锚点位置对应的 x 位置。 分配或报告的单位为页面单位。

Double
elementPositionY
(可读写)

地图框的锚点位置对应的 y 位置。 分配或报告的单位为页面单位。

Double
elementRotation
(可读写)

地图框的旋转角度(以度为单位)。 正值将使方向顺时针旋转,负值将使方向逆时针旋转。 这是地图框在布局上的角度,不是数据的旋转。 使用 camera 上的 heading 属性旋转数据。

Double
elementWidth
(可读写)

页面布局上的地图框宽度。 分配或报告的单位为页面单位。

Double
locked
(可读写)

设置为 True 时,无法在布局视图中以图形方式选择元素。

Boolean
map
(可读写)

在地图框中显示的地图

Map
name
(可读写)

显示在工程窗口中的地图名称。 有必要确保所有地图均具有唯一名称,因为这样可以轻松对其进行引用。

String
time
(只读)

如果启用时间的图层存在于地图框中,则返回 MapTime 对象。 如果地图框不包含启用时间的图层,则返回值 None

提示:

Layer 类中的 enableTime 方法允许您针对具有时间信息的图层启用时间,从而可以访问 LayerTimeMapTime 属性。

MapTime
type
(只读)

返回值 MAPFRAME_ELEMENT

String
visible
(可读写)

如果地图框在布局上可见,则返回 True。 打印或导出之前,您可以打开和关闭元素的可见性,而不必从页面移除不需要的对象。

Boolean

方法概述

方法说明
exportToAIX (out_aix, {resolution}, {image_quality}, {compress_vector_graphics}, {image_compression}, {jpeg_compression_quality}, {embed_fonts}, {embed_color_profile})

将 MapFrame 导出为 Adobe Illustrator Exchange (AIX) 格式。 可在 ArcGIS Maps for Adobe Creative Cloud 扩展模块或 Adobe Illustrator 中使用 AIX 文件。

exportToBMP (out_bmp, {resolution}, {world_file}, {bmp_color_mode}, {bmp_image_compression}, {embed_color_profile})

将 MapFrame 导出为 Microsoft Windows 位图 (BMP) 格式文件。

exportToEMF (out_emf, {resolution}, {image_quality}, {output_as_image})

将 MapFrame 导出为增强型图元文件 (EMF) 格式文件。

exportToEPS (out_eps, {resolution}, {image_compression}, {image_quality}, {embed_fonts}, {output_as_image})

将 MapFrame 导出为封装 PostScript (EPS) 格式文件。

exportToGIF (out_gif, {resolution}, {world_file}, {gif_color_mode})

将 MapFrame 导出为图形交换格式 (GIF) 文件。

exportToJPEG (out_jpg, {resolution}, {world_file}, {jpeg_color_mode}, {jpeg_quality}, {embed_color_profile})

将 MapFrame 导出为联合图像专家组 (JPEG) 格式。

exportToPDF (out_pdf, {resolution}, {image_quality}, {compress_vector_graphics}, {image_compression}, {embed_fonts}, {layers_attributes}, {georef_info}, {jpeg_compression_quality}, {output_as_image}, {embed_color_profile})

将 MapFrame 导出为便携式文档格式 (PDF) 文件。

exportToPNG (out_png, {resolution}, {world_file}, {color_mode}, {embed_color_profile})

用于将 MapFrame 导出为便携式网络图形 (PNG) 格式。

exportToSVG (out_svg, {resolution}, {compress_to_svgz}, {image_quality}, {embed_fonts}, {output_as_image})

将 MapFrame 导出为可伸缩矢量图形 (SVG) 格式文件。

exportToTGA (out_tga, {resolution}, {world_file}, {color_mode})

将 MapFrame 导出为 Truevision 图形适配器 (TGA) 格式文件。

exportToTIFF (out_tif, {resolution}, {world_file}, {color_mode}, {tiff_compression}, {geoTIFF_tags}, {jpeg_compression_quality}, {embed_color_profile})

用于将 MapFrame 导出为标记图像文件格式 (TIFF)。

getLayerExtent (layer, {selection_only}, {symbolized_extent})

返回图层中所有要素或仅仅所选要素的图层范围。

panToExtent (extent)

使用新 Extent 对象可平移和居中 MapFrame,而无需更改地图框的比例。

zoomToAllLayers ({selection_only}, {symbolized_extent})

修改 MapFrame 视图以便与所有图层或地图中所选图层的范围相匹配。

zoomToBookmark (bookmark)

修改 MapFrame 视图以便与通过空间书签存储的视图信息相匹配。

方法

exportToAIX (out_aix, {resolution}, {image_quality}, {compress_vector_graphics}, {image_compression}, {jpeg_compression_quality}, {embed_fonts}, {embed_color_profile})
参数说明数据类型
out_aix

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

String
resolution

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

(默认值为 300)

Integer
image_quality

A string that specifies output image quality, the draw resolution of map layers that draw as rasters.

  • BESTAn output image quality resample ratio of 1
  • BETTERAn output image quality resample ratio of 2
  • NORMALAn output image quality resample ratio of 3
  • FASTERAn output image quality resample ratio of 4
  • FASTESTAn output image quality resample ratio of 5

(默认值为 BEST)

String
compress_vector_graphics

A Boolean that controls compression of vector and text portions of the output file. Image compression is defined separately.

(默认值为 True)

Boolean
image_compression

A string that specifies the compression scheme used to compress image or raster data in the output file.

  • ADAPTIVEAutomatically selects the best compression type for each image on the page. JPEG will be used for large images with many unique colors. DEFLATE will be used for all other images.
  • DEFLATEA lossless data compression.
  • JPEGA lossy data compression.
  • LZWLempel-Ziv-Welch, a lossless data compression.
  • NONECompression is not applied.
  • RLERun-length encoded compression.

(默认值为 ADAPTIVE)

String
jpeg_compression_quality

A number that controls compression quality value when image_compression is set to ADAPTIVE or JPEG. The valid range is 1 through 100. A jpeg_compression_quality of 100 provides the best quality images but creates large export files. The recommended range is between 70 and 90.

(默认值为 80)

Integer
embed_fonts

A Boolean that controls the embedding of fonts in the export file. Font embedding allows text and character markers to be displayed correctly when the document is viewed on a computer that does not have the necessary fonts installed.

(默认值为 True)

Boolean
embed_color_profile

If set to True, color profile information is embedded in the image's metadata.

(默认值为 True)

Boolean

AIX 是从 ArcGIS 导出的 Adobe Illustrator Exchange 文件,可在 ArcGIS Maps for Adobe Creative Cloud 插件中使用。 与插件配合使用时,矢量地图和栅格地图内容将转换为可编辑的 Artwork 图层,以改善 Adobe Illustrator 中的编辑体验。 在 Illustrator 中打开 AIX 后,可用于高端图形设计或地图最后处理工作流,并可在其他 Adobe Creative Cloud 应用程序之间进行迁移。

exportToBMP (out_bmp, {resolution}, {world_file}, {bmp_color_mode}, {bmp_image_compression}, {embed_color_profile})
参数说明数据类型
out_bmp

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

String
resolution

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

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

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

  • 8-BIT_ADAPTIVE_PALETTE8-bit adaptive palette
  • 8-BIT_GRAYSCALE8-bit grayscale
  • 24-BIT_TRUE_COLOR24-bit true color

(默认值为 24-BIT_TRUE_COLOR)

String
bmp_image_compression

A string that specifies the compression scheme used to compress image or raster data in the output file. This option only applies to 8-bit bmp_color_mode options.

  • NONECompression is not applied.
  • RLERun-length encoded compression.

(默认值为 NONE)

String
embed_color_profile

If set to True, color profile information is embedded in the image's metadata.

(默认值为 True)

Boolean

BMP 文件属于本地 Windows 栅格图像。 BMP 文件可以使用多个位深度存储像素数据。 BMP 图像的大小通常比 JPEG 或 PNG 等其他格式的图像大很多。

exportToEMF (out_emf, {resolution}, {image_quality}, {output_as_image})
参数说明数据类型
out_emf

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

String
resolution

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

(默认值为 96)

Integer
image_quality

A string that specifies output image quality, the draw resolution of map layers that draw as rasters.

  • BESTAn output image quality resample ratio of 1
  • BETTERAn output image quality resample ratio of 2
  • NORMALAn output image quality resample ratio of 3
  • FASTERAn output image quality resample ratio of 4
  • FASTESTAn output image quality resample ratio of 5

(默认值为 BEST)

String
output_as_image

If set to True, vector content can be saved as an image. Selecting this option for maps or layouts that contain vector layers with a high density of vertices can reduce the output file size. When exporting to PDF and this option is set to True, you cannot view PDF layers in the output.

(默认值为 False)

Boolean

EMF 文件属于本地 Windows 图形文件,其中既包含矢量数据又包含栅格数据。 这些文件非常适合于嵌入 Windows 文档,因为 EMF 文件的矢量部分可以调整大小,而又不会降低质量。 但是,由于 EMF 文件不支持字体嵌入并且属于 Windows 专用格式,因此并不常用作用户之间的交换格式。

exportToEPS (out_eps, {resolution}, {image_compression}, {image_quality}, {embed_fonts}, {output_as_image})
参数说明数据类型
out_eps

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

String
resolution

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

(默认值为 96)

Integer
image_compression

A string that specifies the compression scheme used to compress image or raster data in the output file.

  • DEFLATEA lossless data compression.
  • LZWLempel-Ziv-Welch, a lossless data compression.
  • NONECompression is not applied.
  • RLERun-length encoded compression.

(默认值为 DEFLATE)

String
image_quality

A string that specifies output image quality, the draw resolution of map layers that draw as rasters.

  • BESTAn output image quality resample ratio of 1.
  • BETTERAn output image quality resample ratio of 2.
  • NORMALAn output image quality resample ratio of 3.
  • FASTERAn output image quality resample ratio of 4.
  • FASTESTAn output image quality resample ratio of 5.

(默认值为 BEST)

String
embed_fonts

A Boolean that controls the embedding of fonts in the export file. Font embedding allows text and character markers to be displayed correctly when the document is viewed on a computer that does not have the necessary fonts installed.

(默认值为 True)

Boolean
output_as_image

If set to True, vector content can be saved as an image. Selecting this option for maps or layouts that contain vector layers with a high density of vertices can reduce the output file size. When exporting to PDF and this option is set to True, you cannot view PDF layers in the output.

(默认值为 False)

Boolean

EPS 文件将通过 PostScript 页面描述语言描述矢量对象和栅格对象。 PostScript 是高端图形文件、制图和打印的出版行业标准。 许多绘图应用程序中都可编辑 EPS 文件,也可将此类文件作为图形置于大多数页面布局应用程序中。 EPS 文件支持字体嵌入,因此即使用户尚未安装 Esri 字体也可以查看正确的符号。

exportToGIF (out_gif, {resolution}, {world_file}, {gif_color_mode})
参数说明数据类型
out_gif

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

String
resolution

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

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

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

  • 8-BIT_PALETTE8-bit adaptive palette
  • 8-BIT_GRAYSCALE8-bit grayscale

(默认值为 8-BIT_PALETTE)

String

GIF 文件属于 Web 中使用的旧的栅格格式。 GIF 无法显示 256 种以上的颜色(每像素 8 位),并且使用的是可选的无损 RLE 压缩或 LZW 压缩方法,因此此类文件的大小比其他格式的文件要小。 类似 PNG,GIF 文件还可定义透明颜色。 GIF 在生成时,还将同时生成一个坐标文件,可用作地理配准栅格数据

exportToJPEG (out_jpg, {resolution}, {world_file}, {jpeg_color_mode}, {jpeg_quality}, {embed_color_profile})
参数说明数据类型
out_jpg

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

String
resolution

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

(默认值为 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. If you export a 3D map frame, this parameter will be ignored regardless of the setting because world files are not applicable to 3D views.

(默认值为 False)

Boolean
jpeg_color_mode

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

  • 8-BIT_GRAYSCALE8-bit grayscale
  • 24-BIT_TRUE_COLOR24-bit true color

(默认值为 24-BIT_TRUE_COLOR)

String
jpeg_quality

This value (0–100) controls the amount of compression applied to the output image. For JPEG, image quality is adversely affected the more compression is applied. A higher quality (highest = 100) setting will produce sharper images and larger file sizes. A lower quality setting will produce more image artifacts and smaller files.

(默认值为 80)

Integer
embed_color_profile

If set to True, color profile information is embedded in the image's metadata.

(默认值为 True)

Boolean

JPEG 文件属于经过压缩的图像文件。 它支持 24 位颜色并且是 Web 上流行的使用格式,因为 JPEG 文件大小通常要比许多其他图像格式小很多。 但是,JPEG 压缩算法会有损质量,多数地图图像中都不推荐使用,因为线绘图以及文本或图标图形会因压缩产生的伪影而变得模糊。 因此,通常 PNG 格式才是地图图像的首选。 在生成 JPEG 文件的同时,还将生成一个坐标文件,可用作地理配准栅格数据。

exportToPDF (out_pdf, {resolution}, {image_quality}, {compress_vector_graphics}, {image_compression}, {embed_fonts}, {layers_attributes}, {georef_info}, {jpeg_compression_quality}, {output_as_image}, {embed_color_profile})
参数说明数据类型
out_pdf

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

String
resolution

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

(默认值为 300)

Integer
image_quality

A string that defines the output image quality and the draw resolution of map layers that draw as rasters.

  • BESTAn output image quality resample ratio of 1
  • BETTERAn output image quality resample ratio of 2
  • NORMALAn output image quality resample ratio of 3
  • FASTERAn output image quality resample ratio of 4
  • FASTESTAn output image quality resample ratio of 5

(默认值为 BEST)

String
compress_vector_graphics

A Boolean that controls the compression of vector and text portions of the output file. Image compression is defined separately.

(默认值为 True)

Boolean
image_compression

A string that defines the compression scheme used to compress image or raster data in the output file.

  • ADAPTIVEAutomatically selects the best compression type for each image on the page. JPEG will be used for large images with many unique colors. DEFLATE will be used for all other images.
  • DEFLATEA lossless data compression.
  • JPEGA lossy data compression.
  • LZWLempel-Ziv-Welch, a lossless data compression.
  • NONECompression is not applied.
  • RLERun-length encoded compression.

(默认值为 ADAPTIVE)

String
embed_fonts

A Boolean that controls the embedding of fonts in the export file. Font embedding allows text and character markers to be displayed correctly when the document is viewed on a computer that does not have the necessary fonts installed.

(默认值为 True)

Boolean
layers_attributes

A string that controls the inclusion of PDF layers and PDF object data (attributes) in the export file.

  • LAYERS_ONLYExport PDF layers only.
  • LAYERS_AND_ATTRIBUTESExport PDF layers and feature attributes.
  • NONENo setting is applied.

(默认值为 LAYERS_ONLY)

String
georef_info

A Boolean that enables the export of coordinate system information for each data frame into the output PDF file.

(默认值为 True)

Boolean
jpeg_compression_quality

A number that controls the compression quality value when image_compression is set to ADAPTIVE or JPEG. The valid range is 1 through 100. A jpeg_compression_quality of 100 provides the best quality images but creates large export files. The recommended range is 70 through 90.

(默认值为 80)

Integer
output_as_image

If set to True, vector content can be saved as an image. Selecting this option for maps or layouts that contain vector layers with a high density of vertices can reduce the output file size. When exporting to PDF and this option is set to True, you cannot view PDF layers in the output.

(默认值为 False)

Boolean
embed_color_profile

If set to True, color profile information is embedded in the image's metadata.

(默认值为 True)

Boolean

PDF 文件可在不同的平台上实现一致的查看和打印效果。 它们常用于在 Web 上分发文档,并且此格式现在属于文档交换的 ISO 官方标准。 PDF 文件在许多图形应用程序中均可编辑,并会保留地图的地理配准信息、注记、标注和要素属性数据。 PDF 导出支持字体嵌入,即使在用户尚未安装 Esri 字体时,也可以正确显示符号系统。

查看 PDFDocument 类以了解更多关于如何管理 PDF 文件的方法,如追加、插入以及设置属性。

exportToPNG (out_png, {resolution}, {world_file}, {color_mode}, {embed_color_profile})
参数说明数据类型
out_png

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

String
resolution

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

(默认值为 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. If you export a 3D map frame, this parameter will be ignored regardless of the setting because world files are not applicable to 3D views.

(默认值为 False)

Boolean
color_mode

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

  • 8-BIT_ADAPTIVE_PALETTE8-bit adaptive palette
  • 8-BIT_GRAYSCALE8-bit grayscale
  • 24-BIT_TRUE_COLOR24-bit true color
  • 32-BIT_WITH_ALPHA32-bit with alpha

(默认值为 32-BIT_WITH_ALPHA)

String
embed_color_profile

If set to True, color profile information is embedded in the image's metadata.

(默认值为 True)

Boolean

PNG 属于通用型栅格格式,可在各种 Web 浏览器上显示并且还可插入其他文档中。 它支持高位深度颜色并使用无损压缩。 对于地图而言,PNG 通常是最佳的栅格格式,因为无损压缩可防止产生 JPEG 格式中的那种压缩伪影,从而使文本和线作业始终清晰可辨。 PNG 文件还可定义透明颜色。 在生成 PNG 文件的同时,还将生成一个坐标文件,可用作地理配准栅格数据。

exportToSVG (out_svg, {resolution}, {compress_to_svgz}, {image_quality}, {embed_fonts}, {output_as_image})
参数说明数据类型
out_svg

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

String
resolution

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

(默认值为 96)

Integer
compress_to_svgz

If set to True, the output is compressed.

(默认值为 False)

Boolean
image_quality

A string that specifies output image quality, the draw resolution of map layers that draw as rasters.

  • BESTAn output image quality resample ratio of 1.
  • BETTERAn output image quality resample ratio of 2.
  • NORMALAn output image quality resample ratio of 3.
  • FASTERAn output image quality resample ratio of 4.
  • FASTESTAn output image quality resample ratio of 5.

(默认值为 BEST)

String
embed_fonts

A Boolean that controls the embedding of fonts in the export file. Font embedding allows text and character markers to be displayed correctly when the document is viewed on a computer that does not have the necessary fonts installed.

(默认值为 True)

Boolean
output_as_image

If set to True, vector content can be saved as an image. Selecting this option for maps or layouts that contain vector layers with a high density of vertices can reduce the output file size. When exporting to PDF and this option is set to True, you cannot view PDF layers in the output.

(默认值为 False)

Boolean

SVG 格式是一种基于 XML 的文件格式,专门适用于在 Web 上进行查看。 SVG 文件可以同时包含矢量信息和栅格信息。 一些 web 浏览器可能需要插件才能查看 SVG 文件。 较早版本的浏览器可能根本无法查看 SVG 文件。 SVG 格式支持字体嵌入,因此即使用户尚未安装 Esri 字体也可以使用正确的符号系统查看导出的 SVG 文件。 用户也可以生成压缩的 SVG 文件。 如果启用此选项,文件扩展名变为 .svgz

exportToTGA (out_tga, {resolution}, {world_file}, {color_mode})
参数说明数据类型
out_tga

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

String
resolution

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

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

  • 8-BIT_ADAPTIVE_PALETTE8-bit adaptive palette
  • 8-BIT_GRAYSCALE8-bit grayscale
  • 24-BIT_TRUE_COLOR24-bit true color
  • 32-BIT_WITH_ALPHA32-bit with alpha

(默认值为 32-BIT_WITH_ALPHA)

String

TGA 文件以往用于其他应用程序中的内容(例如,动画游戏的 Image Sprites),许多受欢迎的图形艺术应用程序均可对该文件进行读取和写入。 TGA 格式支持多位深度,包括支持 alpha(透明)的 32 位。

exportToTIFF (out_tif, {resolution}, {world_file}, {color_mode}, {tiff_compression}, {geoTIFF_tags}, {jpeg_compression_quality}, {embed_color_profile})
参数说明数据类型
out_tif

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

String
resolution

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

(默认值为 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. If you export a 3D map frame, this parameter will be ignored regardless of the setting because world files are not applicable to 3D views.

(默认值为 False)

Boolean
color_mode

This value specifies the number of bits used to describe color. The available options are dependent on the specified Color Model set in the layout's Color Management properties.

  • 8-BIT_ADAPTIVE_PALETTE8-bit adaptive palette. Available to RGB and CMYK.
  • 8-BIT_GRAYSCALE8-bit grayscale. Available to RGB and CMYK.
  • 24-BIT_TRUE_COLOR24-bit true color. Available only to RGB.
  • 32-BIT_WITH_ALPHA32-bit with alpha. Available only to RGB.
  • 32-BIT_CMYK_TRUE_COLOR32-bit CMYK true color. Available only to CMYK.
  • 40-BIT_CMYK_WITH_ALPHA40-bit CMYK with alpha. Available only to CMYK.

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

This value (0–100) controls the amount of compression applied to the output image. With a JPEG image, quality is adversely affected the more compression is applied. A higher quality (highest = 100) setting will produce sharper images and larger file sizes. A lower quality setting will produce more image artifacts and smaller files.

(默认值为 80)

Integer
embed_color_profile

If set to True, color profile information is embedded in the image's metadata.

(默认值为 True)

Boolean

TIFF 文件最适合导入图像编辑应用程序,同时它也属于一种常用的 GIS 栅格数据格式。 但是却无法通过 Web 浏览器在本地查看这些文件。 TIFF 文件还支持在 GeoTIFF 标签中或在单独坐标文件中存储地理配准信息,以便用作栅格数据。

getLayerExtent (layer, {selection_only}, {symbolized_extent})
参数说明数据类型
layer

引用 Layer 对象。

Layer
selection_only

如果为 True,将返回选定要素的范围;如果为 False,将返回所有要素的范围。

(默认值为 True)

Boolean
symbolized_extent

如果值为 True,将返回图层的符号化范围;否则将返回几何范围。符号化范围会将符号覆盖的区域考虑在内,因此该区域不会被数据框边界切掉。

(默认值为 True)

Boolean
返回值
数据类型说明
Extent

地理处理 Extent 对象。

getLayerExtent 方法将支持图层定义查询,因此如果查询了要素子集,则将只返回这些要素的范围。如果未选择要素,则将返回图层的范围。

panToExtent (extent)
参数说明数据类型
extent

地理处理 Extent 对象。

Extent

此方法尤为适合 MapFrame 比例未变而位置发生了变化的情况。无需设置范围以及每次都重置比例,panToExtent 保持比例不变,然后使当前地图框在新范围中居中。

zoomToAllLayers ({selection_only}, {symbolized_extent})
参数说明数据类型
selection_only

如果为 True,将根据选定要素设置范围;如果为 False,将为地图中的所有要素设置范围。

(默认值为 True)

Boolean
symbolized_extent

如果值为 True,将返回图层的符号化范围;否则将返回几何范围。符号化范围会将符号覆盖的区域考虑在内,因此该区域不会被地图框边界切掉。

(默认值为 True)

Boolean

如果对含有全局或本地场景的 MapFrame 使用了 zoomToAllLayers,则将生成平面视图。

zoomToBookmark (bookmark)
参数说明数据类型
bookmark

引用 Bookmark 对象。

Bookmark

如果对引用了 2D 地图MapFrame 使用了 3D 书签(反之亦然),则将生成平面试图。

代码示例

MapFrame 示例 1

下面的脚本将设置名为约塞米蒂国家公园主要景点的布局上名为约塞米蒂国家公园的地图框范围,从而与名为 Ranger Stations 的图层范围相匹配。

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")

m = aprx.listMaps("Yose*")[0]
lyr = m.listLayers("Ranger Stations")[0]
lyt = aprx.listLayouts("Main Attr*")[0]
mf = lyt.listElements("mapframe_element", "Yosemite National Park")[0]
mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))

aprx.saveACopy(r"C:\Projects\YosemiteNP\Yosemite_Updated.aprx")
del aprx
MapFrame 示例 2

下面的脚本演示了如何将引用 2D 地图的地图框更改为引用 3D 地图。首先,该脚本会将两个文档导入到空白项目中。然后,会引用合适的地图和地图框。最后在将 map 属性从 2D 地图更改为 3D 地图之前将 Camera type 属性更改为 GLOBAL

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\Blank.aprx")

#Import documents into project
aprx.importDocument(r"C:\Projects\YosemiteNP\Documents\Yosemite.mxd")
aprx.importDocument(r"C:\Projects\YosemiteNP\Documents\Yosemite_3DViews.3dd")

#Reference maps
m_scenic = aprx.listMaps("Globe layers")[0]

#Reference Layout and map frames
lyt = aprx.listLayouts()[0]
mf_inset1 = lyt.listElements("MapFrame_Element", "Inset1")[0]
mf_inset2 = lyt.listElements("MapFrame_Element", "Inset2")[0]

#Convert inset maps into Globe Views
mf_inset1.camera.type = "GLOBAL"
mf_inset1.map = m_scenic
mf_inset2.camera.type = "GLOBAL"
mf_inset2.map = m_scenic

aprx.saveACopy(r"C:\Projects\YosemiteNP\Yosemite.aprx")