ArcGIS for Desktop

  • 文档
  • 合约
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS for Desktop

全面的专业性 GIS

ArcGIS for Server

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 合约
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

帮助

  • 主页
  • 入门
  • 制图
  • 分析
  • 管理数据
  • 工具
  • 更多...

ExportToSVG

  • 摘要
  • 讨论
  • 语法
  • 代码实例

摘要

以可伸缩矢量图形 (SVG) 格式导出地图文档 (.mxd) 的页面布局或数据框。

讨论

SVG 是一种基于 XML 的文件格式,专门适用于在 Web 上进行文件的查看。SVG 可以同时包含矢量信息和栅格信息。对于在网页中显示的地图,SVG 是一个不错的选择,因为它可以缩放并且比栅格文件更易于编辑。自从万维网联盟 (W3C) 选择将 SVG 作为其标准矢量 Web 格式后,SVG 得到了广泛应用。某些 Web 浏览器可能需要安装插件才能查看 SVG 文件;较早的浏览器可能根本无法查看 SVG 文件。SVG 支持字体嵌入,因此即使用户尚未安装 Esri 字体也可以使用正确符号系统查看导出的 ArcMap SVG 文件。ArcMap 也可以生成压缩的 SVG 文件。如果启用此选项,文件扩展名变为 *.SVGZ。

要导出单个数据框(而不是整个页面布局),可将 DataFrame 对象传给函数的 data_frame 参数。由于数据框导出不具有可提供高度和宽度信息的关联页面,所以必须通过 df_export_width 和 df_export_height 参数来提供此信息。

对于页面布局导出和数据框导出,控制生成图像图形质量的方式有所不同。导出页面布局时,通过更改 resolution 参数来控制图像细节。导出数据框时,保持 resolution 参数的默认值,更改 df_export_width 和 df_export_height 参数来更改图像细节。高度和宽度参数直接控制在导出文件中生成的像素数,且仅在导出数据框时使用。像素数较高的图像具有较高的图像细节。对于大多数页面布局导出,默认参数值应在第一次尝试时生成良好的结果和美观的导出图像。对于数据框导出,您可能需要对 df_export_width 和 df_export_height 值进行若干次试验,之后才能得到理想的结果。

有关导出地图的详细信息,请参阅 ArcGIS 帮助中的导出地图主题。

语法

ExportToSVG (map_document, out_svg, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {image_quality}, {compress_document}, {picture_symbol}, {convert_markers}, {embed_fonts})
参数说明数据类型
map_document

A variable that references a MapDocument object.

MapDocument
out_svg

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

String
data_frame

A variable that references a DataFrame object. Use the string/constant "PAGE_LAYOUT" to export the map document's page layout instead of an individual data frame.

(默认值为 PAGE_LAYOUT)

Object
df_export_width

A number that defines the width of the export image in pixels for a data frame export. df_export_width is only used when exporting a data frame. Exporting a page layout uses the map document page width instead of df_export_width.

(默认值为 640)

Integer
df_export_height

A number that defines the height of the export image in pixels for a data frame export. df_export_height is only used when exporting a data frame. Exporting a page layout uses the map document page height instead of df_export_height.

(默认值为 480)

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

If set to True, a compressed export will be created. For SVG, the entire document is compressed and it changes the file extension to *.svgz.

(默认值为 False)

Boolean
picture_symbol

A string that defines whether picture markers and picture fills will be converted to vector or rasterized on output.

  • RASTERIZE_BITMAP — Rasterize layers with bitmap markers/fills.
  • RASTERIZE_PICTURE —Rasterize layers with any picture marker/fill.
  • VECTORIZE_BITMAP —Vectorize layers with bitmap markers/fills.

(默认值为 RASTERIZE_BITMAP)

String
convert_markers

A Boolean that controls the coversion 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
embed_fonts

A Boolean that controls the embedding of fonts in export files. 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.

(默认值为 False)

Boolean

代码实例

ExportToSVG 示例 1

此脚本使用所有选项的默认值打开地图文档并将页面布局导出为 SVG 文件。

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
arcpy.mapping.ExportToSVG(mxd, r"C:\Project\Output\Project.svg")
del mxd
ExportToSVG 示例 2

与从 ArcMap 应用程序的数据视图中导出类似,此脚本将导出单个数据框(而不是整个页面布局)。df_export_width 和 df_export_height 的默认值分别是 640 和 480。通过传递这些参数的较大值,可以生成细节层次较高的输出图像。

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0]
arcpy.mapping.ExportToSVG(mxd, r"C:\Project\Output\ProjectDataFrame.svg", df,
                          df_export_width=1600,
                          df_export_height=1200)
del mxd
有关此主题的反馈?

ArcGIS for Desktop

  • 主页
  • 文档
  • 合约
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | 隐私政策 | 法律声明