使用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,
"SAVE_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的实现的更多相关文章

  1. 测试开发Python培训:自动发布新浪微博-技术篇

    测试开发Python培训:自动发布新浪微博-技术篇   在前面我们教大家如何登陆,大家需要先看自动登陆新浪微博(http://www.cnblogs.com/laoli0201/articles/48 ...

  2. gitlab+jenkins自动发布Python包到私有仓储

    背景 有个私有仓储,地址为https://your.repo.com/pypi/ 代码存储在gitlab, 地址为https://gitlab.company.com/software.git CI为 ...

  3. Python + Selenium 自动发布文章(一):开源中国

    https://blog.csdn.net/qq_28804275/article/details/80891949 https://blog.csdn.net/qq_28804275/article ...

  4. jenkins结合supervisor进行python程序发布后的自动重启

    jenkins结合supervisor进行python程序发布后的自动重启 项目背景: 通过jenkins发布kvaccount.chinasoft.com站点的python服务端程序,业务部门同事需 ...

  5. 解决GP服务产生的结果无法自动发布为地图服务的问题

    在ArcGIS for Javascript API或REST API调用GP服务时,常常会遇到这样一种情况:GP服务运行以后,执行成功,也能够生成结果,然而结果并没有直接产生动态的地图服务供API调 ...

  6. GeoServer自动发布地图服务

    1 NetCDF气象文件自动发布案例 GeoServer是一个地理服务器,提供了管理页面进行服务发布,样式,切片,图层预览等一系列操作,但是手动进行页面配置有时并不满足业务需求,所以GeoServer ...

  7. 自动发布工具版本从python2升级成python3后遇到的种种问题(涉及paramiko,Crypto,zipfile等等)

    从在公司实习到正式入职,一直还在被同事使用的是我写的一个自动发布工具.该工具的主要功能是:开发人员给出需要更新的代码包(zip格式),测试人员将该代码包部署到测服,这些代码包和JIRA数据库里的项目信 ...

  8. Azure 基础:用 PowerShell 自动发布 CloudServices

    在软件的开发过程中,自动化的编译和部署能够带来很多的优势.下面我们聊聊如何自动发布云应用程序到 azure 上的 cloud services. 打包要发布的内容 首先使用 msbuild 编译 *. ...

  9. 使用Jenkins自动发布Windows服务项目

    不同于发布Web项目,自动发布Windows服务项目需要解决以下几个问题: 如何远程停止和开启服务?需要在发布前停止服务,在发布完成后开启服务. 如何上传编译文件到目标服务器? 问题1:如何远程停止和 ...

随机推荐

  1. sdi 采集卡---环视频拼接直播方案

    http://www.upano.cn/# 360度无死角直播1080p 30fps http://search.jd.com/Search?keyword=sdi%E9%87%87%E9%9B%86 ...

  2. linux -- Ubuntu 命令技巧合集

    http://www.nenew.net/UbuntuSkills.html#.E6.9F.A5.E7.9C.8B.E8.BD.AF.E4.BB.B6xxx.E5.AE.89.E8.A3.85.E5. ...

  3. python中使用@property

    class Student(object): @property def score(self): return self._score @score.setter def score(self, v ...

  4. SharePoint 2013 设置customErrors显示实际的错误信息

    一.首先设置IIS中的Web.config文件 找到对应的IIS应用程序目录,如:C:\inetpub\wwwroot\wss\VirtualDirectories\3000 在此文件夹下包含一个we ...

  5. 基于Nginx反向代理及负载均衡

    基于Nginx反向代理及负载均衡 参考:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass 只要没有被启用,默认就是 ...

  6. 【Windows】win10应用商店被删后恢复方法!

    以管理员身份运行PowerShell,输入以下命令后回车(可直接复制粘贴): Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableD ...

  7. meta标签整理

    meta指元素可提供有关页面的元信息(meta-information),比如针对搜索引擎和更新频度的描述和关键词.标签位于文档的头部,不包含任何内容. 标签的属性定义了与文档相关联的名称/值对. 一 ...

  8. Tcp/ip实验准备:一个简单的定时器——boost实现

    tcp/ip实验须要在指定的时间查看结果,为了实验方便,做了一个定时器.用法是: 在命令行输入:timer 输入数字之后,计时对应秒数 输入m数字之后.计时对应分钟数(支持小数分钟数) 输入q退出. ...

  9. 超全面的JavaWeb笔记day21<过滤器>

    1.过滤器的原理 2.实现过滤器 写一个类实现javax.servlet.Filter接口 在web.xml中对Filter进行配置 3.Filter接口 void init(FilterConfig ...

  10. 下载SpringJar包

    方法一: 地址:http://repo.spring.io/release/org/springframework/spring/ 此方法简单. 方法二: 安装TortoiseSVN后,在电脑的任意空 ...