ConvertToMSD
Récapitulatif
Converts a map to a map service definition (MSD) file
Discussion
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.
Syntaxe
Paramètre | Explication | Type de données |
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. (La valeur par défaut est USE_ACTIVE_VIEW) | DataFrame |
msd_anti_aliasing | A string that sets antialiasing for nontext items within the saved MSD.
(La valeur par défaut est NONE) | String |
msd_text_anti_aliasing | A string that sets antialiasing for text items within the saved MSD.
(La valeur par défaut est NONE) | String |
Exemple de code
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