AnalyzeForMSD

Summary

Analyzes map documents (.mxd) to determine sources for potential suitability and performance issues when converting a map to a map service definition (MSD) file

Discussion

One of the important tasks that you can perform is to analyze your map document to identify potential performance bottlenecks and map errors that you will need to address before you can create an optimized map service from your ArcMap document.

This function returns a Python dictionary containing errors and other potential issues that you should address prior to publishing your map document as an optimized map service. It helps you to identify layer and symbology types that are not supported for optimized map drawing performance, warnings for issues that can potentially slow down display performance, and other information messages about your map document that can help you optimize its performance as a map service. You will see three types of messages in this report: errors, warnings, and information.

Errors typically refer to your map's use of map layer types or display options that are not supported for optimized map services. All errors must be repaired before you can publish an MSD. Warnings and other messages identify issues that may affect drawing performance and appearance. Warnings alert you to issues in which drawing performance or drawing appearance may be affected, but these issues do not preclude you from converting the map to an MSD.

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

Related functions: ConvertToMSD and PublishMSDToServer

Syntax

AnalyzeForMSD (map_document)
ParameterExplanationData Type
map_document

A variable that references a MapDocument object

MapDocument

Code Sample

AnalyzeForMSD example

This script prints the messages, errors, and warnings contained in an AnalyzeForMSD result.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\ReadyForMSD.mxd")
analysis = arcpy.mapping.AnalyzeForMSD(mxd)

for key in ('messages', 'warnings', 'errors'):
  print "----" + key.upper() + "---"
  vars = analysis[key]
  for ((message, code), layerlist) in vars.iteritems():
    print "    ", message, " (CODE %i)" % code
    print "       applies to:",
    for layer in layerlist:
        print layer.name,
    print

del mxd


11/21/2011