SVGFormat
Résumé
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.
Discussion
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.
Propriétés
| Nom | Explication | Type de données |
|---|---|---|
|
clipToElements (Lecture et écriture) |
If set to |
Boolean |
|
compressToSVGZ (Lecture et écriture) |
If set to |
Boolean |
|
convertMarkers (Lecture et écriture) |
Controls whether marker symbols based on font characters are exported as font characters or as polygons. Set this option to |
Boolean |
|
embedFonts (Lecture et écriture) |
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 Remarque :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 (Lecture et écriture) |
A string that represents the system path and file name, including the extension, for the exported file. |
String |
|
height (Lecture et écriture) |
The height, in pixels, of the map area to be exported. This property only applies when exporting a |
Double |
|
imageQuality (Lecture et écriture) |
The amount of image resampling. The property determines the effective resolution of raster content on output. For instance, if
|
String |
|
includeNonVisibleMapLayers (Lecture et écriture) |
If set to |
Boolean |
|
outputAsImage (Lecture et écriture) |
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 Remarque :Options specific to vector data, such as |
Boolean |
|
rasterAsSingleTile (Lecture et écriture) |
If set to Remarque :If sufficient memory cannot be allocated, the export process will fail. To reduce memory requirements, set |
Boolean |
|
resolution (Lecture et écriture) |
The effective dpi of the output vector data. The default value is 96. Remarque :When exporting a |
Integer |
|
showSelectionSymbology (Lecture et écriture) |
Show selected features in the map or map frame as selected in the output file. Setting this value to |
Boolean |
|
width (Lecture et écriture) |
The width, in pixels, of the map area to be exported. This property only applies when exporting a |
Double |
Méthodes
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.
| Nom | Explication | Type de données |
|---|---|---|
|
image_quality |
Below is a list of valid strings.
|
String |
Exemple de code
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)
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)