删除 Globe 服务器缓存 (Server)

许可等级:BasicStandardAdvanced

摘要

删除现有 globe 服务缓存中的一个或多个图层及其包含的所有切片。

用法

语法

DeleteGlobeServerCache_server (service, Layer)
参数说明数据类型
service

待删除的图层缓存所属的 globe 服务。

这是一个包含服务器和服务器信息的字符串。要查看构建此字符串的方法,请打开 ArcCatalog,选择“目录”树中的服务,并注意位置 工具条中的文本。然后将反斜线改为正斜线,例如,MYSERVER (admin)/Seattle.GlobeServer 上的 GIS Servers/arcgis

String
Layer

要删除缓存的 globe 服务中的图层。默认情况下将包含服务的所有图层。如果有一个图层未包含在内,则不会删除该图层的缓存。

String

代码实例

在本例中,将删除 globe 服务缓存的所有图层。

#DeleteGlobeServerCache example For ArcGIS Server 10.1 Beta(stand-alone script)

# Name: DeleteGlobeServerCache.py
# Description: The following stand-alone script deletes globe server cache
# Requirements: os, sys, time & traceback modules
# Author: ESRI

# Any line that begins with a pound sign is a comment and will not be executed
# Empty quotes take the default value.
# To accept arguments from the command line replace values of variables to
#                                                           "sys.argv[]"

# Import system modules
import arcpy
from arcpy import env
import os, sys, time, datetime, traceback, string

# Set environment settings
env.workspace = "C:/data"

# List of input variables for map service properties
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
globeServiceName = "tstGlobeService.GlobeService"
globeService = connectionFile + "\\" + server + "\\" + globeServiceName
inputLayers = ""

currentTime = datetime.datetime.now()
arg1 = currentTime.strftime("%H-%M")
arg2 = currentTime.strftime("%Y-%m-%d %H:%M")
file = 'C:/data/report_%s.txt' % arg1

# print results of the script to a report
report = open(file,'w')

try:
    starttime = time.clock()
    result = arcpy.DeleteGlobeServerCache_server(globeService, inputLayers)
    finishtime = time.clock()
    elapsedtime = finishtime - starttime

    #print messages to a file
    while result.status < 4:
        time.sleep(0.2)
    resultValue = result.getMessages()
    report.write ("completed " + str(resultValue))

    print "Deleted the GlobeServer cache successfully for globeservice "
    globeServiceName + "\n in " + str(elapsedtime) + " sec \n on " + arg2

except Exception, e:
    # If an error occurred, print line number and error message
    tb = sys.exc_info()[2]
    report.write("Failed at \n" "Line %i" % tb.tb_lineno)
    report.write(e.message)
report.close()
    
print "Deleted the globe server cache successfully"

环境

此工具不使用任何地理处理环境

相关主题

许可信息

ArcGIS for Desktop Basic:需要 3D Analyst
ArcGIS for Desktop Standard:需要 3D Analyst
ArcGIS for Desktop Advanced:需要 3D Analyst
9/15/2013