Summary
Converts a raster or mosaic dataset to a Service Definition Draft file (.sddraft).
The CreateImageSDDraft function is the first step to automating the publishing of a mosaic dataset or raster dataset as an image service using ArcPy. The output created from the CreateImageSDDraft function is a Service Definition Draft file (.sddraft), which is a combination of a mosaic dataset in the geodatabase or a raster dataset, information about the server, and a set of service properties. This service definition draft can be staged as a service definition and uploaded to a specified ArcGIS server as an image service.
Caution:
Service Definition Draft files must be converted to Service Definition files (.sd) before they can be used to publish to ArcGIS Server. These functions are not included in ArcGIS AllSource at this time. You must use ArcGIS Desktop to stage and publish.
Information about the server includes the server connection or server type being published to, the type of service being published, metadata for the service (Item info), and data references (whether data is copied to the server).
Note:
A draft service definition does not contain data. A draft service alone cannot be used to publish a service.
Syntax
CreateImageSDDraft (raster_or_mosaic_layer, out_sddraft, service_name, {server_type}, {connection_file_path}, {copy_data_to_server}, {folder_name}, {summary}, {tags})
Parameter | Explanation | Data Type |
raster_or_mosaic_layer | The raster layer or mosaic layer that will be published. | String |
out_sddraft | A string that represents the path and file name for the output Service Definition Draft file (.sddraft). | String |
service_name | A string that represents the name of the service. This is the name people will see and use to identify the service. The name can only contain alphanumeric characters and underscores. No spaces or special characters are allowed. The name cannot be more than 120 characters. | String |
server_type | A string representing the server type. If a connection_file_path parameter value is not supplied, a server_type value must be provided. If a connection_file_path parameter value is supplied, the server_type value is taken from the connection file. In this case, you can choose FROM_CONNECTION_FILE or skip the parameter entirely.
(The default value is ARCGIS_SERVER) | String |
connection_file_path | A string that represents the path and file name to the ArcGIS Server connection file (.ags). (The default value is None) | String |
copy_data_to_server | A Boolean that indicates whether the source data referenced by the mosaic dataset, the mosaic dataset itself, or the raster dataset published as an image service will be copied to the server. The copy_data_to_server parameter is only used if the server_type value is ARCGIS_SERVER and the connection_file_path value isn't specified. If the connection_file_path value is specified, the server's registered data stores are used. For example, if the workspace that contains the source data referenced by the mosaic dataset—the mosaic dataset or raster dataset is registered with the server—copy_data_to_server will always be False. Conversely, if the workspace that contains the source data referenced by the mosaic dataset—the mosaic dataset or raster dataset is not registered with the server—copy_data_to_server will always be True.
(The default value is False) | Boolean |
folder_name | A string that represents the folder name where the service definition will be published. If the folder does not exist, it will be created. The default folder is the server root level. (The default value is None) | String |
summary | A string that represents the Item Description Summary. Use this parameter to override the user interface summary or to provide a summary if one does not exist. (The default value is None) | String |
tags | A string that represents the Item Description Tags. Use this parameter to override the user interface tags or to provide tags if they do not exist. (The default value is None) | String |
Code sample
Create an image service definition draft file.
import arcpy
ws = "C:/workspace"
mdpath = os.path.join(ws, "fgdb.gdb/mdDEM")
con = os.path.join(ws, "myserver_6080 (publisher).ags")
service = 'dem_service'
sddraft = os.path.join(ws, service + '.sddraft')
arcpy.CreateImageSDDraft(mdpath, sddraft, service, 'ARCGIS_SERVER',
con, True, None, "Publish las MD",
"las,image service")