CreateImageSDDraft

Résumé

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 is a Service Definition Draft (.sddraft) file, 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 service definition then uploaded to a specified ArcGIS server as an image service.

Attention :

Service Definition Draft (.sddraft) files must be converted into Service Definition (.sd) files before they can be use to publish for ArcGIS Server. These functions are not included in ArcGIS Pro at this time. ArcGIS Desktop is required 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 or not data is being copied to the server).

Remarque :

A draft service definition does not contain data. A draft service alone cannot be used to publish a service.

Syntaxe

CreateImageSDDraft (raster_or_mosaic_layer, out_sddraft, service_name, {server_type}, {connection_file_path}, {copy_data_to_server}, {folder_name}, {summary}, {tags})
ParamètreExplicationType de données
raster_or_mosaic_layer

The raster layer or mosaic layer that you want to publish.

String
out_sddraft

A string that represents the path and file name for the output Service Definition Draft (.sddraft) file.

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 in length.

String
server_type

A string representing the server type. If a connection_file_path parameter is not supplied, then a server_type must be provided. If a connection_file_path parameter is supplied, then the server_type is taken from the connection file. In this case, you can choose FROM_CONNECTION_FILE or skip the parameter entirely.

  • ARCGIS_SERVERArcGIS Server server type.
  • FROM_CONNECTION_FILEGet the server_type as specified in the connection_file_path parameter.

(La valeur par défaut est ARCGIS_SERVER)

String
connection_file_path

A string that represents the path and file name to the ArcGIS Server connection file (.ags).

(La valeur par défaut est 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 or not.

The copy_data_to_server parameter is only used if the server_type is ARCGIS_SERVER and the connection_file_path isn't specified. If the connection_file_path is specified, then 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 itself or raster dataset registered with the server—then 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—then copy_data_to_server will always be True.

  • FalseThe data will not be copied to the server. This is the default.
  • TrueThe data will be copied to the server.

(La valeur par défaut est False)

Boolean
folder_name

A string that represents a folder name to which you want to publish the service definition. If the folder does not currently exist, it will be created. The default folder is the server root level.

(La valeur par défaut est 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.

(La valeur par défaut est 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.

(La valeur par défaut est None)

String

Exemple de code

CreateImageSDDraft example 1

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")

Rubriques connexes