ArcGIS Desktop

  • 文档
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

CreateGISServerConnectionFile

  • 摘要
  • 说明
  • 语法
  • 代码示例

摘要

此函数创建可连接到 GIS 服务器的连接文件。

说明

此函数创建可连接到 ArcGIS Server 或 Spatial Data Server 的连接文件。该连接文件随后可用于发布 GIS 服务。例如,CreateGISServerConnectionFile 可以同 CreateMapSDDraft、过渡服务和上传服务定义一起使用使地图发布过程达到完全自动化。

相关函数:

  • CreateMapSDDraft
  • CreateGPSDDraft
  • CreateImageSDDraft
  • CreateGeocodeSDDraft

语法

CreateGISServerConnectionFile (connection_type, out_folder_path, out_name, server_url, server_type, {use_arcgis_desktop_staging_folder}, {staging_folder_path}, {username}, {password}, {save_username_password})
参数说明数据类型
connection_type

A string that represents the connection type. You can create a connection to use, publish, or administer GIS Services.

  • USE_GIS_SERVICES —Use GIS Services.
  • PUBLISH_GIS_SERVICES —Publish GIS Services.
  • ADMINISTER_GIS_SERVICES —Administer GIS Services.
String
out_folder_path

The folder path where the .ags file will be stored. Entering a value of GIS Servers will put the .ags file in the GIS Servers node in the Catalog window.

String
out_name

The name of the .ags file. The output file extension must end with .ags.

String
server_url

A string that represents the URL to the server.

String
server_type

A string that represents the type of server.

  • ARCGIS_SERVER —ArcGIS Server server type
  • SPATIAL_DATA_SERVER —Spatial Data Server server type

旧版本:

If you are using SPATIAL_DATA_SERVER server_type, starting at ArcGIS 10.2.1 for Desktop, only USE_GIS_SERVICES connection_type is supported. Any connection_type is supported for ARCGIS_SERVER server_type.

(默认值为 ARCGIS_SERVER)

String
use_arcgis_desktop_staging_folder

A Boolean that determines whether to use ArcGIS Desktop's staging folder. If set to true, you do not have to enter a staging_folder_path as ArcGIS Desktop's staging folder will be used. This parameter is only used if the connection_type is PUBLISH_GIS_SERVICES or ADMINISTER_GIS_SERVICES.

(默认值为 True)

Boolean
staging_folder_path

A string that represents the staging folder path. If you will be using this connection to create and save service definitions, you can choose where the service definition files will be staged on disk. By default, they are staged in a folder on your local machine. If this parameter is set to None, ArcGIS Desktop's staging folder will be used. This parameter is only used if the connection_type is PUBLISH_GIS_SERVICES or ADMINISTER_GIS_SERVICES.

String
username

A string that represents the user name to the GIS server.

String
password

A string that represents the password to the GIS server.

String
save_username_password

A Boolean that represents whether the user name and password to the GIS Server will be saved in the connection file.

  • SAVE_USERNAME — Save the user name and password in the connection file.
  • DO_NOT_SAVE_USERNAME — Do not save the user name and password in the connection file.

(默认值为 True)

Boolean

代码示例

CreateGISServerConnectionFile 示例 1

以下脚本可在用户定义的文件夹中创建 ArcGIS Server 管理连接文件。

import arcpy
outdir = 'C:/Project'
out_folder_path = outdir
out_name = 'test.ags'
server_url = 'http://MyServer:6080/arcgis/admin'
use_arcgis_desktop_staging_folder = False
staging_folder_path = outdir
username = 'admin'
password = 'admin'
    
arcpy.mapping.CreateGISServerConnectionFile("ADMINISTER_GIS_SERVICES",
                                            out_folder_path,
                                            out_name,
                                            server_url,
                                            "ARCGIS_SERVER",
                                            use_arcgis_desktop_staging_folder,
                                            staging_folder_path,
                                            username,
                                            password,
                                            "SAVE_USERNAME")
CreateGISServerConnectionFile 示例 2

以下脚本可在目录 窗口的 GIS 服务器节点中创建 ArcGIS Server 用户连接文件。

import arcpy
out_folder_path = 'GIS Servers'
out_name = 'test.ags'
server_url = 'http://MyServer:6080/arcgis/services'
   
arcpy.mapping.CreateGISServerConnectionFile("USE_GIS_SERVICES",
                                            out_folder_path,
                                            out_name,
                                            server_url,
                                            "ARCGIS_SERVER",
                                            username='admin',
                                            password='admin',
                                            save_username_password=True)

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

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

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2018 Esri. | 隐私政策 | 法律声明