Skip to main content

SVGFormat

サマリー

The SVGFormat object represents a collection of Scalable Vector Graphics (SVG) file properties that can be configured and used with the export method on the Layout, MapFrame, and MapView objects to create an output SVG or SVGZ file.

ディスカッション

SVG is an XML-based file format that has been specifically designed for viewing on the web. SVG can contain both vector and raster information. Some web browsers may require a plug-in to view SVG files; older browsers may not be able to view SVG files at all. SVG supports font embedding. You can also choose to produce compressed SVG files by setting the compressToSVGZ property to True. The file extension changes to *.svgz.

The createExportFormat method can be used to create a SVGFormat object if the format parameter is set to SVG. The returned SVGFormat object contains all the properties associated with a generating a SVG file. These properties can be modified accordingly to produce different output results.

プロパティ

名前 説明 データ タイプ

clipToElements

(読み取り/書き込み)

If set to True, include the areas of the page that have map or layout element content only, rather than exporting the entire page. This property only applies when exporting a Layout object. The default value is False.

Boolean

compressToSVGZ

(読み取り/書き込み)

If set to True, the file is compressed and the extension should be set to *.svgz. The default value is False.

Boolean

convertMarkers

(読み取り/書き込み)

Controls whether marker symbols based on font characters are exported as font characters or as polygons. Set this option to True to view the output on a machine that does not have the appropriate fonts installed when you cannot embed the fonts due to licensing or file format restrictions. This does not apply to text, only marker symbols based on fonts. The default value is False.

Boolean

embedFonts

(読み取り/書き込み)

Include embeddable fonts in the exported file to maintain font consistency across different platforms. Fonts that do not support embedding are not included, regardless of this setting. The default value is True.

注意:

To correctly edit text as graphics, Illustrator requires fonts to be installed and accessible. Check the sharing permissions before embedding and sharing fonts. For high-range characters or ligatures, font embedding should be used to ensure proper addressing of these high-range characters. In the case where a font with high-range characters or ligatures cannot be embedded, check the Draw glyphs as geometry property on the text symbol.

Boolean

filePath

(読み取り/書き込み)

A string that represents the system path and file name, including the extension, for the exported file.

String

height

(読み取り/書き込み)

The height, in pixels, of the map area to be exported. This property only applies when exporting a MapView object. The default value is 960.

Double

imageQuality

(読み取り/書き込み)

The amount of image resampling. The property determines the effective resolution of raster content on output. For instance, if imageQuality is set to BETTER, a resample ratio of 1:2, and the output resolution is set to 300 dpi, the raster content is output at approximately 150 dpi. In many cases, the raster data can be included at a lower dpi than the vector data without visibly affecting quality, reducing the output file size. The default value is BEST.

  • 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

String

includeNonVisibleMapLayers

(読み取り/書き込み)

If set to True, this property ensures that all layers in the map are included in the exported file, including layers with visibility unchecked. The visibility status of all layers is retained in the exported file. Use this option to create deliverables with several views of the same data. When this property is set to False, only visible layers in the map are included in the exported file. Non-visible layers are dropped. The default value is False.

Boolean

outputAsImage

(読み取り/書き込み)

Export vector content as an image. For maps or layouts containing vector layers with a high density of vertices, this can drastically reduce the output file size. The default value is False.

注意:

Options specific to vector data, such as embedFonts, are unavailable when outputAsImage is set to True.

Boolean

rasterAsSingleTile

(読み取り/書き込み)

If set to True, export raster and rasterized layers as a single tile image to avoid artifacts in transparent layers in some PDF viewers. The default value is False.

注意:

If sufficient memory cannot be allocated, the export process will fail. To reduce memory requirements, set rasterAsSingleTile to False, and instead, try reducing the imageQuality, resolution, or set the antialiasing value to None. The antialiasing value is set on the DisplayOptions class when running scripts outside of the application, or on the Display tab in the Project options, if running scripts within the application.

Boolean

resolution

(読み取り/書き込み)

The effective dpi of the output vector data. The default value is 96.

注意:

When exporting a MapView, the dpi is calculated automatically using system dpi scaling and therefore this value will be ignored.

Integer

showSelectionSymbology

(読み取り/書き込み)

Show selected features in the map or map frame as selected in the output file. Setting this value to False does not affect selection within the view, only in the output file. The default value is False.

Boolean

width

(読み取り/書き込み)

The width, in pixels, of the map area to be exported. This property only applies when exporting a MapView object. The default value is 960.

Double

方法

setImageQuality(image_quality)

A string constant that sets the amount of image resampling.

The value determines the effective resolution of raster content on output. For instance, if the output image quality ratio is set to 1:2, an image_quality value of BETTER, and the output resolution is set to 300 dpi, the raster content is output at approximately 150 dpi. In many cases, the raster data can be included at a lower dpi than the vector data without visibly affecting quality, reducing the output file size.

名前 説明 データ タイプ

image_quality

Below is a list of valid strings.

  • 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

String

コードのサンプル

SVGFormat example 1

The following script exports a layout to SVG format using default property values.

p = arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts()[0]

svg = arcpy.mp.CreateExportFormat('SVG', r'C:\Temp\Output.svg')

lyt.export(svg)
SVGFormat example 2

The following script exports a layout to compressed SVG format by setting the compressToSVGZ property to True.

p = arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts()[0]

svg = arcpy.mp.CreateExportFormat('SVG', r'C:\Temp\Output.svgz')
svg.compressToSVGZ = True  #Change from default value of False

lyt.export(svg)