Frequently asked question

What are the ArcPy classes used to publish a map object with a service definition file from ArcGIS Pro?

Last Published: May 18, 2021

Answer

In ArcGIS Pro, the ArcPy classes are used to publish a map object with a service definition file. This article includes a compilation that describes the type of map object and the corresponding workflows according to the destination portal.

Map object typeHosted Feature Layer and Tile LayerNon-hosted Map and Feature Services
Destination portalArcGIS Online and ArcGIS EnterpriseFederated ArcGIS and GIS ServerStandalone ArcGIS and GIS Server
Create a Map objectArcGIS Pro: MapArcGIS Pro: MapArcGIS Pro: Map
Create a service definition draft object from map objectArcGIS Pro: Methods
Refer to the getWebLayerSharingDraft() function.
ArcGIS Pro: Methods 
Refer to the getWebLayerSharingDraft() function.

For a feature service, use the Modify SDDraft example code sample in ArcGIS Pro: Code sample.
ArcGIS Pro: CreateSharingDraft()

For a feature service, use the Modify SDDraft example code sample in ArcGIS Pro: Code sample.
Export the service definition drat object (.sddraft) to a fileArcGIS Pro: Methods
Refer to the exportToSDDraft() function.
ArcGIS Pro: Methods
Refer to the exportToSDDraft() function.
ArcGIS Pro: Methods
Refer to the exportToSDDraft() function.
Stage the service by creating the service definition (.sd)ArcGIS Pro: Stage Service (Server)ArcGIS Pro: Stage Service (Server)ArcGIS Pro: Stage Service (Server)
Publish the service definition to the destination portalArcGIS Pro: Upload Service Definition (Server)ArcGIS Pro: Upload Service Definition (Server)ArcGIS Pro: Upload Service Definition (Server)
Complete code samplesTo publish as a web feature layer, refer to ArcGIS Pro: Code Sample (FeatureSharingDraft).

To publish as a web tile layer, refer to ArcGIS Pro: Code sample (TileSharingDraft).
To publish as a map image layer, refer to the MapImageSharingDraft script example in ArcGIS Pro: Code sample.To publish a map image service with a modified service definition draft file, refer to the Modify SDDraft example in ArcGIS Pro: Code sample.

Article ID:000022132

Software:
  • ArcGIS Pro 2 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic