Python自动发布Image service的实现
2015-08-17 16:59
585 查看
使用Python自动发布地图服务已经在上一篇博客中讲到,使用Python创建.sd服务定义文件,实现脚本自动发布ArcGIS服务,下面是利用Python自动发布Image
service的实现。
-----------华丽的分割线-----------<span style="font-size:14px;"># -*- coding: utf-8 -*- # --------------------------------------------------------------------------- # PublishImageService.py # Created on: 2015-08-15 15:49:27.00000 # (generated by HUIHUI) # Usage: # Description: python publish service # --------------------------------------------------------------------------- # Import arcpy module import os as OS import arcpy # createGISServerConnectionFile,define local variable wrkpc = r"\\qnap.geoWindPower.com\WPServices\hh\PublishService\ToolData" out_folder_path = wrkpc con_Filename = "test.ags" server_url = r"http://gisserver018207.geoWindPower.com/arcgis" staging_folder_path = wrkpc username = "admin" password = "admin" arcpy.mapping.CreateGISServerConnectionFile("PUBLISH_GIS_SERVICES", out_folder_path, con_Filename, server_url, "ARCGIS_SERVER", False, staging_folder_path, username, password, "S***E_USERNAME") # define local variables wrkpc = r"\\qnap.geoWindPower.com\WPServices\hh\PublishService\ToolData" mxdpath = OS.path.join(wrkpc,"mymxd.mxd") mapDoc = arcpy.mapping.MapDocument(mxdpath) servicename = "GeoTurbine_Test" sddraft = OS.path.join(wrkpc,"GeoTurbine_Test.sddraft") sd = OS.path.join(wrkpc,"GeoTurbine_Test.sd") connectionfile = "test.ags" summary = "this is a test" tags = "this is a test" # creste service definition draft analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, servicename, "ARCGIS_SERVER", connectionfile, False, "WP_MapService", summary,tags) #stage and upload the service if the sddraft analysis didn't contain errors if analysis['errors'] == {}: # excute StageService arcpy.StageService_server(sddraft,sd) # excute UploadServiceDfinition arcpy.UploadServiceDefinition_server(sd,connectionfile) else: # if the sddraft analysis contained errors,display them print analysis['errors'] </span>
--------欢迎来访,拒绝转载--------
相关文章推荐
- Python自动发布Image service的实现
- Python IDE:PyCharm中的那些实用功能
- python学习:IndentationError:expected an indented block错误解决
- Python matplotlib 画图相关
- Python入门基础-easygui的使用_fileopenbox()的使用
- python检查目录文件权限并修改目录文件权限
- python 逻辑回归 程序解析
- python2.7学习笔记(6) ——高级特性:切片、迭代、列表生成式、生成器
- PAT 02-4. Pop Sequence (25) Python C
- 【转】python之import机制
- 初触Python,关于pyquery解析html(百度贴吧)
- 《利用Python进行数据分析》第二章pivot_table报错问题
- python自定义包导入
- Python高级特性
- 第二部分:高级抓取(第七章、清理脏数据)
- 介绍Python 和 Scikit-Learn 的机器学习
- Python中map,reduce,filter和sorted函数的使用方法
- python基础学习——列表(list), 元祖(tuple), 字典(dict), 字符串(string), 集合(set) 介绍及相互转换
- python爬队员oj题数
- Python开发入门与实战17-新浪云部署