ConvertToMSD

摘要

Converts a map to a map service definition (MSD) file

讨论

Once you have analyzed map performance, corrected errors, and made other changes to your map document, you can use the ConvertToMSD function to convert a map document into a map service definition (.msd) file. If the map document contains multiple data frames, you can specify which data frame you want to use as the active data frame for the published service. Only an ArcGIS Server administrator can later switch the active data frame to another data frame within the MSD.

A runtime error will result if you attempt to convert a map document to an MSD if the map document has any components that are not supported for optimized map services. This includes all layers for all data frames. Errors can be identified by using the AnalyzeForMSD function.

For more information on analyzing map documents for conversion to MSD files for optimized map publishing, see Publishing optimized map services.

Once all errors are removed and the map document is successfully converted, the PublishMSDToServer function can be used to publish the service to ArcGIS Server.

语法

ConvertToMSD (map_document, out_msd, {data_frame}, {msd_anti_aliasing}, {msd_text_anti_aliasing})
参数说明数据类型
map_document

A variable that references a MapDocument object.

MapDocument
out_msd

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

String
data_frame

A variable that references a DataFrame object. If more than one data frame exists, it is important to specify which data frame will be the active data frame for the published service. The default value is the active data frame.

(默认值为 USE_ACTIVE_VIEW)

DataFrame
msd_anti_aliasing

A string that sets antialiasing for nontext items within the saved MSD.

  • NONE No antialiasing is performed.
  • FASTEST Minimal antialiasing is performed, optimized for speed.
  • FAST Some antialiasing is performed, optimized for speed with better quality than FASTEST.
  • NORMAL A good balance of speed and quality.
  • BEST The best quality antialiasing. This option takes the longest to render.

(默认值为 NONE)

String
msd_text_anti_aliasing

A string that sets antialiasing for text items within the saved MSD.

  • FORCE Text is always drawn with antialiasing, regardless of the individual font's parameters.
  • NORMAL Antialiasing is performed as determined by the font. Each individual font has parameters created within it by the font author that define which sizes the font should draw with antialiasing.
  • NONE No antialiasing is performed.

(默认值为 NONE)

String

代码示例

ConvertToMSD example

This script converts a map to a map service definition (MSD) file.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\ReadyForMSD.mxd")
msd = r"C:\Project\Output\Project.msd"
df = arcpy.mapping.ListDataFrames(mxd, "County Maps")[0]
arcpy.mapping.ConvertToMSD(mxd, msd, df, "NORMAL", "NORMAL")
del mxd, msd


7/10/2012