Skip to main content

addGrid

Краткая информация

Объект MapFrame представляет собой элемент компоновки, который используется для отображения содержимого карты. Он также предоставляет доступ к размеру компоновки, положению в компоновке простым методам навигации и опциям экспорта.

Обсуждение

MapFrame является элементом компоновки, который отображает географическую информацию, добавленную на map. Метод listElements для объекта Layout возвращает список Python элементов компоновки. Чтобы получить список, содержащий только фреймы карты, используйте константу MAPFRAME_ELEMENT для параметра element_type. wildcard также может быть использована для дальнейшей настройки поиска по name элемента.

Метод createMapFrame класса Layout также возвратит ссылку на фрейм карты.

После получения ссылки на MapFrame, свойства и методы позволяют выполнять различные операции. Во-первых, есть базовые свойства, позволяющие управлять размером, расположением и видимостью фрейма карты в компоновке. Во-вторых, существует несколько методов навигации, таких как panToExtent, zoomToAllLayers и zoomToBookmark, которые позволяют изменять область интереса, отображаемую во фрейме карты. В-третьих, свойство map позволяет вам изменять или получать доступ к связанной map. Отсюда вы можете напрямую управлять слоями, таблицами и базовыми картами на карте, а также получать доступ к информации на карте camera, что позволяет вам еще больше изменять область интереса. Вы можете переключать карты одного и того же измерения или разных измерений. Наконец, существует метод export, позволяющий экспортировать фрейм карты в различные форматы.

Подсказка:

Экспорт компоновки MapFrame работает стабильнее, чем попытки экспортировать MapView вне приложения. Ограничением экспорта MapView является то, что представления карты работают только со скриптами Python, выполняемыми внутри приложения. Это связано с тем, что размер окна и область интереса известны только тогда, когда открыто и приложение, и его панели просмотра. При экспорте компоновки MapFrame вся информация о размерах сохраняется в этом элементе, поэтому скрипты, запускаемые как в самом приложении, так и автономные скрипты вне приложения дадут одинаковый результат экспорта.

Синтаксис

addGrid()

Свойства

Имя Объяснение Тип данных

anchor

(Только для чтения)

Возвращает одно из следующих строковых значений, которые описывают текущую позицию якоря. Чтобы изменить значение, используйте метод setAnchor.

  • BOTTOM_LEFT_CORNER—В левом нижнем углу

  • BOTTOM_MID_POINT—Снизу по центру

  • BOTTOM_RIGHT_CORNER—В правом нижнем углу

  • CENTER_POINT—В центре

  • LEFT_MID_POINT—Слева по центру

  • RIGHT_MID_POINT—Справа по центру

  • TOP_LEFT_CORNER—В левом верхнем углу

  • TOP_MID_POINT—Сверху по центру

  • TOP_RIGHT_CORNER—В правом верхнем углу

String

camera

(Чтение / Запись)

Свойство Camera позиции расположения и наблюдателя данных, отображаемых в виде карты.

Camera

elementHeight

(Чтение / Запись)

Высота фрейма карты на компоновке страницы. Единицы измерения задаются или считываются в единицах страницы.

Double

elementPositionX

(Чтение / Запись)

Х-положение позиции точки якоря фрейма карты. Единицы измерения задаются или считываются в единицах страницы.

Double

elementPositionY

(Чтение / Запись)

Y-положение позиции точки якоря фрейма карты. Единицы измерения задаются или считываются в единицах страницы.

Double

elementRotation

(Чтение / Запись)

Угол поворота фрейма карты в градусах Положительные значения поворачивают по часовой стрелке, а отрицательные – против часовой стрелки. Это угол поворота фрейма карты на компоновке, а не угол поворота данных. Воспользуйтесь свойством heading camera для поворота данных.

Double

elementWidth

(Чтение / Запись)

Ширина фрейма карты на компоновке страницы. Единицы измерения задаются или считываются в единицах страницы.

Double

locked

(Чтение / Запись)

Если установлено значение True, элемент нельзя выбрать графически в виде компоновки.

Boolean

map

(Чтение / Запись)

Карта, отображенная во фрейме карты.

Map

name

(Чтение / Запись)

Имя элемента. Важно, чтобы у всех элементов были уникальные имена, благодаря чему на них можно было бы ссылаться с помощью параметра wildcard функции listElements объекта Layout.

String

time

(Только для чтения)

Возвращает объект MapTime, если во фрейме карты есть слои со включенным временем. Значение None возвращается, если во фрейме карты нет слоев со включенным временем.

Подсказка:

Метод enableTime класса Layer позволяет включить время на слое, содержащем информацию о времени и делает возможным доступ к свойствам LayerTime и MapTime.

MapTime

type

(Только для чтения)

Возвращает значение MAPFRAME_ELEMENT.

String

visible

(Чтение / Запись)

Возвращает True, если фрейм карты видим на компоновке. Вместо того чтобы удалять ненужные объекты со страницы перед печатью или экспортом, вы можете включать и выключать видимость элементов.

Boolean

Методы

addGrid(style_item)

Метод addGrid добавляет сетку к MapFrame с помощью элемента стиля.

Имя Объяснение Тип данных

style_item

The reference to a grid StyleItem object using the listStyleItems method on the ArcGISProject class.

StyleItem

convertGridToFeatures(grid_name, output_geodatabase, {new_grid_name})

Преобразует сетки или градусные сетки MapFrame в пространственные объекты базы геоданных.

Имя Объяснение Тип данных

grid_name

The name of the grid or graticule the way it appears in the Contents pane.

String

output_geodatabase

The full path to a file geodatabase (*.gdb) or an enterprise geodatabase (*.sde) including the geodatabase name and extension.

String

new_grid_name

(Дополнительный)

The new name of the group layer added to the map frame's map that will contain all the resulting feature layers. This value will also be added to the GridName field in each feature class table.

String

createBookmark({name}, {description})

Метод createBookmark создает закладку для карты, связанную с фреймом карты и использующую текущие настройки камеры.

Имя Объяснение Тип данных

name

(Дополнительный)

An string that represents the name of the new bookmark. If a name is not provided, the default name will follow the sequencing nomenclature, for example, Bookmark, Bookmark [1], Bookmark [2].

String

description

(Дополнительный)

A string that represents the bookmark's description. If not specified, the value is an empty string.

String

Возвращаемое значение

Тип данных Объяснение

Bookmark

Объект bookmark.

export(export_format, {display_options})

Метод export экспортирует MapFrame, используя указанный export_format.

Имя Объяснение Тип данных

export_format

The supported export format objects are: AIXFormat, BMPFormat, EMFFormat, EPSFormat, GIFFormat, JPEGFormat, PDFFormat, PNGFormat, SVGFormat, TGAFormat and TIFFFormat.

Object

display_options

(Дополнительный)

The DisplayOptions object includes antialiasing mode options.

Object

exportToAIX(out_aix, {resolution}, {image_quality}, {compress_vector_graphics}, {image_compression}, {jpeg_compression_quality}, {embed_fonts}, {embed_color_profile}, {convert_markers})

Экспортирует MapFrame в формат Adobe Illustrator Exchange (AIX). Файлы AIX можно использовать с дополнительным модулем ArcGIS Maps for Adobe Creative Cloud или Adobe Illustrator.

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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.

  • BEST—An output image quality resample ratio of 1

  • BETTER—An output image quality resample ratio of 2

  • NORMAL—An output image quality resample ratio of 3

  • FASTER—An output image quality resample ratio of 4

  • FASTEST—An 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.

  • ADAPTIVE—Automatically 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.

  • DEFLATE—A lossless data compression.

  • JPEG—A lossy data compression.

  • JPEG2000—Offers higher quality compression with smaller file size than JPEG. This compression is lossless if jpeg_compression_quality is set to 100.

  • LZW—Lempel-Ziv-Welch, a lossless data compression.

  • NONE—Compression is not applied.

  • RLE—Run-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

convert_markers

(Дополнительный)

A Boolean that controls the conversion of character-based marker symbols to polygons. This allows the symbols to appear correctly if the symbol font is not available or cannot be embedded. However, setting this parameter to True disables font embedding for all character-based marker symbols, which can result in a change in their appearance.

(Значение по умолчанию — False)

Boolean

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

Экспортирует MapFrame в файл формата Microsoft Windows Bitmap (BMP).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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_PALETTE—8-bit adaptive palette

  • 8-BIT_GRAYSCALE—8-bit grayscale

  • 24-BIT_TRUE_COLOR—24-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.

  • NONE—Compression is not applied.

  • RLE—Run-length encoded compression.

(Значение по умолчанию — NONE)

String

embed_color_profile

(Дополнительный)

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

(Значение по умолчанию — True)

Boolean

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

Экспортирует MapFrame в файл формата Enhanced Metafile (EMF).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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.

  • BEST—An output image quality resample ratio of 1

  • BETTER—An output image quality resample ratio of 2

  • NORMAL—An output image quality resample ratio of 3

  • FASTER—An output image quality resample ratio of 4

  • FASTEST—An 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

convert_markers

(Дополнительный)

A Boolean that controls the conversion of character-based marker symbols to polygons. This allows the symbols to appear correctly if the symbol font is not available or cannot be embedded. However, setting this parameter to True disables font embedding for all character-based marker symbols, which can result in a change in their appearance.

(Значение по умолчанию — False)

Boolean

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

Экспортирует MapFrame в файл формата Encapsulated PostScript (EPS).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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.

  • DEFLATE—A lossless data compression.

  • LZW—Lempel-Ziv-Welch, a lossless data compression.

  • NONE—Compression is not applied.

  • RLE—Run-length encoded compression.

(Значение по умолчанию — DEFLATE)

String

image_quality

(Дополнительный)

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

  • BEST—An output image quality resample ratio of 1.

  • BETTER—An output image quality resample ratio of 2.

  • NORMAL—An output image quality resample ratio of 3.

  • FASTER—An output image quality resample ratio of 4.

  • FASTEST—An 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

convert_markers

(Дополнительный)

A Boolean that controls the conversion of character-based marker symbols to polygons. This allows the symbols to appear correctly if the symbol font is not available or cannot be embedded. However, setting this parameter to True disables font embedding for all character-based marker symbols, which can result in a change in their appearance.

(Значение по умолчанию — False)

Boolean

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

Экспортирует MapFrame в файл формата Graphic Interchange Format (GIF).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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_ADAPTIVE_PALETTE—8-bit adaptive palette

  • 8-BIT_GRAYSCALE—8-bit grayscale

(Значение по умолчанию — 8-BIT_ADAPTIVE_PALETTE)

String

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

Экспортирует MapFrame в формат Joint Photographic Experts Group (JPEG).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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_GRAYSCALE—8-bit grayscale

  • 24-BIT_TRUE_COLOR—24-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

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}, {convert_markers}, {simulate_overprint})

Экспортирует MapFrame в файл Portable Document Format (PDF).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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.

  • BEST—An output image quality resample ratio of 1

  • BETTER—An output image quality resample ratio of 2

  • NORMAL—An output image quality resample ratio of 3

  • FASTER—An output image quality resample ratio of 4

  • FASTEST—An 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.

  • ADAPTIVE—Automatically 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.

  • DEFLATE—A lossless data compression.

  • JPEG—A lossy data compression.

  • JPEG2000—Offers higher quality compression with smaller file size than JPEG. This compression is lossless if jpeg_compression_quality is set to 100.

  • LZW—Lempel-Ziv-Welch, a lossless data compression.

  • NONE—Compression is not applied.

  • RLE—Run-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_ONLY—Export PDF layers only.

  • LAYERS_AND_ATTRIBUTES—Export PDF layers and feature attributes.

  • NONE—No 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

convert_markers

(Дополнительный)

A Boolean that controls the conversion of character-based marker symbols to polygons. This allows the symbols to appear correctly if the symbol font is not available or cannot be embedded. However, setting this parameter to True disables font embedding for all character-based marker symbols, which can result in a change in their appearance.

(Значение по умолчанию — False)

Boolean

simulate_overprint

(Дополнительный)

Sometimes called soft proofing, simulating overprinting shows a representation of how overlapping areas of ink will appear when printed on a page. You set up overprinting on symbol layers.

(Значение по умолчанию — False)

Boolean

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

Экспортирует MapFrame в формат Portable Network Graphics (PNG).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

out_png

Строка, представляющая путь и имя выходного файла для экспорта.

String

resolution

(Дополнительный)

Число, определяющее разрешение файла для экспорта в точках на дюйм (dpi).

(Значение по умолчанию — 96)

Integer

world_file

(Дополнительный)

Если в этом поле установлено значение True, то создается файл пространственной привязки. Файл содержит информацию о масштабе в пикселах и о реальных пространственных координатах. Если вы экспортируете фрейм карты 3D, этот параметр игнорируется независимо от настроек, так как файл привязки не используется в 3D-видах.

(Значение по умолчанию — False)

Boolean

color_mode

(Дополнительный)

Это значение определяет количество битов, используемых для описания цвета.

  • 8-BIT_ADAPTIVE_PALETTE—8-bit adaptive palette

  • 8-BIT_GRAYSCALE—8-bit grayscale

  • 24-BIT_TRUE_COLOR—24-bit true color

  • 32-BIT_WITH_ALPHA—32-bit with alpha

(Значение по умолчанию — 32-BIT_WITH_ALPHA)

String

embed_color_profile

(Дополнительный)

Если оно задано как True, то информация о цвете профиля будет встроена в метаданные изображения.

(Значение по умолчанию — True)

Boolean

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

Экспортирует MapFrame в файл формата Scalable Vector Graphics (SVG).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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.

  • BEST—An output image quality resample ratio of 1.

  • BETTER—An output image quality resample ratio of 2.

  • NORMAL—An output image quality resample ratio of 3.

  • FASTER—An output image quality resample ratio of 4.

  • FASTEST—An 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

convert_markers

(Дополнительный)

A Boolean that controls the conversion of character-based marker symbols to polygons. This allows the symbols to appear correctly if the symbol font is not available or cannot be embedded. However, setting this parameter to True disables font embedding for all character-based marker symbols, which can result in a change in their appearance.

(Значение по умолчанию — False)

Boolean

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

Экспортирует MapFrame в файл формата Truevision Graphics Adapter (TGA).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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_PALETTE—8-bit adaptive palette

  • 8-BIT_GRAYSCALE—8-bit grayscale

  • 24-BIT_TRUE_COLOR—24-bit true color

  • 32-BIT_WITH_ALPHA—32-bit with alpha

(Значение по умолчанию — 32-BIT_WITH_ALPHA)

String

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

Экспортирует MapFrame в Tagged Image File Format (TIFF).

Прежние версии:

Этот метод заменен на export в версии 3.4 ArcGIS Pro и остается для использования только в устаревших скриптах. Все усовершенствования и будущие разработки будут осуществляться только методом экспорта.

Имя Объяснение Тип данных

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_PALETTE—8-bit adaptive palette. Available to RGB and CMYK.

  • 8-BIT_GRAYSCALE—8-bit grayscale. Available to RGB and CMYK.

  • 24-BIT_TRUE_COLOR—24-bit true color. Available only to RGB.

  • 32-BIT_WITH_ALPHA—32-bit with alpha. Available only to RGB.

  • 32-BIT_CMYK_TRUE_COLOR—32-bit CMYK true color. Available only to CMYK.

  • 40-BIT_CMYK_WITH_ALPHA—40-bit CMYK with alpha. Available only to CMYK.

(Значение по умолчанию — 24-BIT_TRUE_COLOR)

String

tiff_compression

(Дополнительный)

This value represents a compression scheme.

  • DEFLATE—A lossless data compression.

  • JPEG—JPEG compression.

  • LZW—Lempel-Ziv-Welch, a lossless data compression.

  • NONE—Compression is not applied.

  • PACK_BITS—Pack 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

getDefinition(cim_version)

Возвращает определение CIM элемента фрейма карты.

Имя Объяснение Тип данных

cim_version

A string that represents the major version of the CIM that will be used.

  • V2—The 2.x version of the CIM will be used.

  • V3—The 3.x version of the CIM will be used.

String

Возвращаемое значение

Тип данных Объяснение

Object

Возвращает определение CIM для значения MapFrame.

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

Возвращает экстент слоя для всех объектов или только выбранных объектов слоя.

Имя Объяснение Тип данных

layer

Ссылка на объект Layer.

Layer

selection_only

(Дополнительный)

Если имеет значение True, то возвращает экстент для выбранных объектов; в случае значения False возвращает экстент для всех объектов.

(Значение по умолчанию — True)

Boolean

symbolized_extent

(Дополнительный)

При настройке Истина (True) возвращается символьный экстент; в противном случае возвращается геометрический экстент. Символьный экстент охватывает ту область, которую покрывают символы, так что он не выходит за границы фрейма данных.

(Значение по умолчанию — True)

Boolean

Возвращаемое значение

Тип данных Объяснение

Extent

Объект геообработки Extent.

panToExtent(extent)

Перемещает и центрирует фрейм карты MapFrame с использованием объекта Extent без изменения масштаба фрейма карты.

Имя Объяснение Тип данных

extent

Объект геообработки Extent.

Extent

removeGrids({wildcard})

Метод removeGrids удаляет одну или несколько сеток из фрейма карты.

Имя Объяснение Тип данных

wildcard

(Дополнительный)

A wildcard is based on the grid or graticule name in the Contents pane and is not case sensitive. A combination of asterisks (*) and characters can be used to limit the resulting list.

(Значение по умолчанию — None)

String

setAnchor(anchor)

Метод setAnchor управляет положением якоря для элемента MapFrame.

Имя Объяснение Тип данных

anchor

A string that specifies the location of the anchor position.

  • BOTTOM_LEFT_CORNER—The anchor will be set at the bottom left corner position.

  • BOTTOM_MID_POINT—The anchor will be set at the bottom center position.

  • BOTTOM_RIGHT_CORNER—The anchor will be set at the bottom right corner position.

  • CENTER_POINT—The anchor will be set at the center position.

  • LEFT_MID_POINT—The anchor will be set at the left center position.

  • RIGHT_MID_POINT—The anchor will be set at the right center position.

  • TOP_LEFT_CORNER—The anchor will be set at the top left corner position.

  • TOP_MID_POINT—The anchor will be set at the top center position.

  • TOP_RIGHT_CORNER—The anchor will be set at the top right corner position.

String

setDefinition(definition_object)

Задает определение CIM элемента фрейма карты.

Имя Объяснение Тип данных

definition_object

A modified CIM definition object originally retrieved using getDefinition.

Object

zoomToAllLayers({selection_only}, {symbolized_extent})

Изменяет вид MapFrame, чтобы он соответствовал экстенту всех слоев или выбранных слоев карты.

Имя Объяснение Тип данных

selection_only

(Дополнительный)

Если имеет значение True, то устанавливает экстент на основе выбранных объектов; в случае значения False, устанавливает экстент для отображения всех объектов карты.

(Значение по умолчанию — True)

Boolean

symbolized_extent

(Дополнительный)

При настройке Истина (True) возвращается символьный экстент; в противном случае возвращается геометрический экстент. Символьный экстент охватывает ту область, которую покрывают символы, так что он не выходит за границы фрейма данных карты.

(Значение по умолчанию — True)

Boolean

zoomToBookmark(bookmark)

Изменяет вид MapFrame, чтобы он соответствовал информации об элементе, хранящейся вместе с пространственной закладкой.

Имя Объяснение Тип данных

bookmark

Ссылка на объект Bookmark.

Bookmark

Пример кода

MapFrame, пример 1

Следующий скрипт задает экстент фрейма карты различными способами и экспортирует каждый результат в PDF. Сначала задается экстент с помощью выборки объектов. Затем он приближается к экстенту одного слоя и применяется небольшой буфер. Наконец, он делает то же самое, но приближается экстент каждого объекта.

import arcpy, os
aprx = arcpy.mp.ArcGISProject(r'C:\Projects\GreatLakes\GreatLakes.aprx')

m = aprx.listMaps('Map')[0]
lyr = m.listLayers('GreatLakes')[0]
lyt = aprx.listLayouts('Layout')[0]
mf = lyt.listElements('mapframe_element', 'Map Frame')[0]

#Zoom to ALL selected features and export to PDF
arcpy.SelectLayerByAttribute_management(lyr, 'NEW_SELECTION', "NAME = 'Lake Superior'")
mf.zoomToAllLayers(True)
pdf = arcpy.mp.CreateExportFormat('PDF', r'C:\Projects\GreatLakes\Selection.pdf')
mf.export(pdf)
arcpy.SelectLayerByAttribute_management(lyr, 'CLEAR_SELECTION')

#Set the map frame extent to the extent of a layer and export to PDF
mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))
mf.camera.scale = mf.camera.scale * 1.1 #add a slight buffer
pdf.filePath = r'C:\Projects\GreatLakes\GreatLakesExtent.pdf'
mf.export(pdf)

#Set the map frame extent based on each feature in a layer and export to PDF
for row in arcpy.da.SearchCursor(lyr, ['SHAPE@', 'NAME']):
    mf.camera.setExtent(row[0].extent)
    mf.camera.scale = mf.camera.scale * 1.1 #add a slight buffer
    pdf.filePath = os.path.join(r'C:\Projects\GreatLakes', f'{row[1]}.pdf')
    mf.export(pdf)
MapFrame, пример 2

В следующем скрипте импортируется MXD и 3DD документ в пустой проект. После ссылки на соответствующие элементы он заменяет каждую из 2D карт-врезок на 3D-сцены и применяет подходящую закладку к каждому фрейму карты. Наконец, вся компоновка экспортируется в PDF.

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

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

#Reference maps
scene = p.listMaps('Globe layers')[0]

#Reference Layout and map frames
lyt = p.listLayouts()[0]
mainMF = lyt.listElements('MapFrame_Element', 'Yosemite National Park*')[0]
inset1MF = lyt.listElements('MapFrame_Element', 'Inset1*')[0]
inset2MF = lyt.listElements('MapFrame_Element', 'Inset2*')[0]

#Convert imported 2D insets into 3D views and zoom to bookmarks
mainMF.zoomToBookmark(mainMF.map.listBookmarks('Yosemite Valley')[0])

inset1MF.map = scene
inset1MF.zoomToBookmark(inset1MF.map.listBookmarks('Yosemite Yalley (looking East)')[0])

inset2MF.map = scene
inset2MF.zoomToBookmark(inset2MF.map.listBookmarks('Yosemite Yalley (looking West)')[0])

#Export the resulting imported layout and changes to PDF
pdf = arcpy.mp.CreateExportFormat('PDF', r'C:\Projects\YosemiteNP\Example2_Export.pdf')
lyt.export(pdf)
MapFrame, пример 3

В следующем скрипте демонстрируется, как можно создать фрейм карты, используя геометрию Polygon и геометрию Point.

p = arcpy.mp.ArcGISProject("CURRENT")

#Create a new map, layout
m = p.createMap('New Map', 'MAP')
lyt = p.createLayout(8.5, 11, 'INCH', 'New Layout')
lyt.openView()

#Create a new map frame using a polygon geometry
envCoordList = [[0.5, 5.75], [0.5, 10.5], [8, 10.5], [8, 5.75], [0.5, 5.75]]
envArray = arcpy.Array([arcpy.Point(*coords) for coords in envCoordList])
mf1 = lyt.createMapFrame(arcpy.Polygon(envArray), m, 'New MF - Poly')

#Create a new bookmark set to the map frame's default extent
bkmk = mf1.createBookmark('Default Extent', "The map's default extent")
bkmk.updateThumbnail()

#Create a new map frame using a point geometry
mf2 = lyt.createMapFrame(arcpy.Point(0.5,0.5), m, 'New MF - Point')
mf2.elementWidth = 7.5
mf2.elementHeight = 4.75
MapFrame, пример 4

В следующем скрипте показано, как можно использовать Python CIM Access для изменения символов границ каждого фрейма карты компоновки.

p = arcpy.mp.ArcGISProject('CURRENT')
lyt = p.listLayouts('Layout')[0]
lyt_cim = lyt.getDefinition('V3')
for elm in lyt_cim.elements:
    if type(elm).__name__ == 'CIMMapFrame':
        if elm.graphicFrame.borderSymbol.symbol.symbolLayers:
            sym = elm.graphicFrame.borderSymbol.symbol.symbolLayers[0]
            sym.width = 5
            sym.color.values = [255, 0, 0, 100]
        else:
            print(elm.name + ' has NO symbol layers')
lyt.setDefinition(lyt_cim)