摘要
将栅格或镶嵌数据集转换为服务定义草稿文件 (.sddraft)。
CreateImageSDDraft 函数是使用 ArcPy 自动发布镶嵌数据集或栅格数据集作为“影像服务”的第一步。 基于 CreateImageSDDraft 函数创建的输出是服务定义草稿文件 (.sddraft),该文件由栅格数据集或地理数据库中的镶嵌数据集、服务器信息以及一组服务属性组合而成。 该服务定义草稿可作为服务定义过渡,然后作为影像服务上传至指定的 ArcGIS 服务器。
警告:
服务定义草稿文件必须先转换为服务定义文件 (.sd),之后才能用于发布到 ArcGIS Server。 ArcGIS Pro 中目前不包括这些函数。 必须使用 ArcGIS Desktop 来过渡和发布。
服务器信息包括服务器连接或者已发布的服务器的类型,正在发布的服务的类型,服务的元数据(项目信息)和数据参考(是否向服务器复制数据)。
注:
草稿服务定义不包含数据。 草稿服务不能单独用于发布服务。
语法
CreateImageSDDraft (raster_or_mosaic_layer, out_sddraft, service_name, {server_type}, {connection_file_path}, {copy_data_to_server}, {folder_name}, {summary}, {tags})
参数 | 说明 | 数据类型 |
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.
(默认值为 ARCGIS_SERVER) | String |
connection_file_path | A string that represents the path and file name to the ArcGIS Server connection file (.ags). (默认值为 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.
(默认值为 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. (默认值为 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. (默认值为 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. (默认值为 None) | String |
代码示例
创建影像服务定义草稿文件。
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")