Skip to main content

createBookmark

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

Класс MapView предназначен для использования в двух рабочих процессах. Во-первых, его можно использовать с проекте ArcGIS Pro для доступа к текущему активному виду карты. Во-вторых его можно использовать в сочетании с ConvertWebMapToArcGISProject в веб-картах, печатающихся с помощью веб-инструмента, для доступа к виду карты для печати или экспорта.

Обсуждение

Класс MapView можно использовать для получения доступа к активному виду карты в проекте ArcGIS Pro. Свойство activeView из класса ArcGISProject будет возвращать либо объект MapView, если активен вид карты, либо объект Layout или Report, если активен вид компоновки или вид отчета. При любом другом типе вида будет возвращаться None. Свойство activeView предназначено для скриптов, которые будут выполняться в приложении ArcGIS Pro, например, скриптов, запущенных на панели Python, или тех, которые связаны с инструментом скрипта.

MapView, возвращенный из свойства activeView, это основной способ изменить экстент Камеры, связанной с видом. Вы также можете изменить свойство defaultCamera объекта Map перед вызовом метода openView, и вновь открытый вид будет учитывать эти настройки камеры. В классе ArcGISProject есть метод closeViews, полезный для закрытия ненужных видов перед открытием вида, на котором нужен больший фокус.

Класс MapView также может использоваться в рабочих процессах печати веб-карт. Класс MapView обеспечивает доступ к виду карты для печати или экспорта веб-карты, которая не содержит вспомогательные элементы страницы компоновки (например, заголовок, легенду или масштабную линейку). В основном используется разработчиками веб-приложений, для создания приложений печати веб-карт. Для получения дополнительной информации см. раздел ConvertWebMapToArcGISProject.

Внимание:

Не все методы MapView доступны для разработчиков веб-приложений. Следующие методы не поддерживаются в веб-приложении для печати карт:

  • getLayerExtent

  • panToExtent

  • zoomToAllLayers

  • zoomToBookmark

Синтаксис

createBookmark()

Свойства

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

camera

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

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

Camera

map

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

Карта связана с MapView.

Map

Методы

createBookmark({name}, {description})

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

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

name

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

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

String

description

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

An optional string that represents the bookmark's description.

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

String

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

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

Bookmark

Объект Bookmark.

export(export_format, {display_options})

Метод export экспортирует MapView, используя указанный 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, width, height, {resolution}, {image_quality}, {compress_vector_graphics}, {image_compression}, {jpeg_compression_quality}, {embed_fonts}, {embed_color_profile}, {convert_markers})

Экспортирует MapView в формат 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {resolution}, {world_file}, {bmp_color_mode}, {bmp_image_compression}, {embed_color_profile})

Экспортирует MapView в файл формата 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {resolution}, {image_quality}, {output_as_image}, {convert_markers})

Экспортирует MapView в файл формата 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {resolution}, {image_compression}, {image_quality}, {embed_fonts}, {output_as_image}, {convert_markers})

Экспортирует MapView в файл формата 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {resolution}, {world_file}, {gif_color_mode})

Экспортирует MapView в файл 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {resolution}, {world_file}, {jpeg_color_mode}, {jpeg_quality}, {embed_color_profile})

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

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

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

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

out_jpg

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

String

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {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})

Экспортирует MapView в файл 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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—None.

(Значение по умолчанию — 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, width, height, {resolution}, {world_file}, {color_mode}, {embed_color_profile})

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

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

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

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

out_png

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

String

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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_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

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

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

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

Boolean

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

Экспортирует MapView в файл формата 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {resolution}, {world_file}, {color_mode})

Экспортирует MapView в файл формата 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

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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, width, height, {resolution}, {world_file}, {color_mode}, {tiff_compression}, {geoTIFF_tags}, {jpeg_compression_quality}, {embed_color_profile})

Экспортирует MapView в файл Tagged Image File Format (TIFF).

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

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

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

out_tif

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

String

width

A number that defines the width of the export in pixels.

Integer

height

A number that defines the height of the export in pixels.

Integer

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 the 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

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

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

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

layer

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

Layer

selection_only

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

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

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

Boolean

symbolized_extent

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

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

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

Boolean

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

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

Extent

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

panToExtent(extent)

Передвигает и центрирует MapView с использованием объекта Extent без изменения масштаба вида карты.

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

extent

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

Extent

zoomToAllLayers({selection_only}, {symbolized_extent})

Настраивает вид MapView для всех слоев или только слоев, выбранных на карте.

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

selection_only

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

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

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

Boolean

symbolized_extent

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

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

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

Boolean

zoomToBookmark(bookmark)

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

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

bookmark

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

Bookmark

Пример кода

Пример активного вида карты

В этом примере экстент MapView изменен для текущего активного вида карты перед тем, как он будет экспортирован в файл PNG. Ссылка на проект ArcGIS Pro использует ключевое слово current. Этот скрипт предназначен для запуска на панели Python или в инструменте скрипта.

import arcpy, os

aprx = arcpy.mp.ArcGISProject('current')
mv = aprx.activeView

# Change the extent of the map view
ext = mv.camera.getExtent()
ext.XMin = ext.XMin + 100
ext.YMin = ext.YMin + 100
ext.XMax = ext.XMax - 100
ext.YMax = ext.YMax - 100
mv.camera.setExtent(ext)

# Export the map view
Output_File = os.path.join(arcpy.env.scratchFolder, 'ActiveMapView.png')
mv.exportToPNG(Output_File, width=1000, height=1000, world_file=True, color_mode="32-BIT_WITH_ALPHA")
Пример печати веб-карты MapView

В этом примере скрипт считывает веб-карту JSON. Выходной MapView из ConvertWebMapToArcGISProject экспортируется в файл PNG.

import arcpy
import os
import uuid

# Input web map json
Web_Map_as_JSON = arcpy.GetParameterAsText(0)

# Convert the web map to an ArcGIS Project
result = arcpy.mp.ConvertWebMapToArcGISProject(Web_Map_as_JSON)
aprx = result.ArcGISProject

# Get the map view
m = aprx.listMaps()[0]
mv = m.defaultView

# Use the uuid module to generate a GUID as part of the output name
# This will ensure a unique output name
output = 'WebMap_{}.png'.format(str(uuid.uuid1()))
Output_File = os.path.join(arcpy.env.scratchFolder, output)

# Export the web map
mv.exportToPNG(Output_File, result.outputSizeWidth, result.outputSizeHeight, result.DPI)

# Set the output parameter to be the output file of the server job
arcpy.SetParameterAsText(1, Output_File)

# Clean up
del mv, m, aprx, result
Пример CreateMap и открытия вида карты

Следующий скрипт использует ключевое слово current, поэтому он должен быть запущен из окна Python. Скрипт создает новую карту и добавляет в нее новые слои. Обновляется свойство камеры карты по умолчанию, которое управляет экстентом вновь открываемых видов. Вид карты затем экспортируется в PDF. После чего вновь созданная карта удаляется из проекта.

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

#Create a copy of an existing map
newMap = aprx.createMap("Ranger Stations", "Map")

#Add ranger stations layer file
lyrx1 = arcpy.mp.LayerFile(r"C:\Projects\YosemiteNP\LayerFiles\Park Boundary.lyrx")
newMap.addLayer(lyrx1)
lyrx2 = arcpy.mp.LayerFile(r"C:\Projects\YosemiteNP\LayerFiles\Ranger Stations.lyrx")
newMap.addLayer(lyrx2)

#Close any current map or layout views
aprx.closeViews("MAPS_AND_LAYOUTS")

#Set the default map camera to the extent of the park boundary before opening the new view
#default camera only affects newly opened views
lyr = newMap.listLayers("*Park Boundary")[-1]
newMap.defaultCamera.setExtent(arcpy.Describe(lyr).extent)
newMap.openView()

#export the newly opened active view to PDF, then delete the new map
mv = aprx.activeView
mv.exportToPDF(r"C:\Temp\RangerStations.pdf", width=700, height=500, resolution=96)
aprx.deleteItem(newMap)