ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Publishing a map service with Python

You can automate map service publishing in a Python script. To do this, you need to call the following sequence of functions from the arcpy.mapping module and tools from the Server toolbox.

  1. Use the arcpy.mapping function CreateMapSDDraft to create a draft service definition (.sddraft). This function reads your map document (MXD) and creates the draft service definition.

    Tip:

    The above-linked topic contains a full code example for publishing a map service using Python.

  2. Use the arcpy.mapping function AnalyzeForSD to analyze your draft service definition for errors that might prevent its publishing. This function returns a Python list of errors, warnings, and informational messages that can help you validate whether your map is ready for publishing. This list is similar to what you get when you click the Analyze button from the Service Editor dialog box in ArcGIS for Desktop.
  3. Run the Stage Service geoprocessing tool on your draft service definition. This converts your draft into a service definition (.sd) that is ready to publish to ArcGIS for Server.
  4. Run the Upload Service Definition geoprocessing tool to publish your service definition as a service.
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

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

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal