ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

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

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

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

ArcGIS Solutions

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

ArcGIS Marketplace

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

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

ArcMap

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

删除地图服务器缓存

  • 描述
  • 使用方法
  • 语法
  • 代码示例
  • 环境
  • 许可信息

描述

删除现有地图或影像服务缓存(包括磁盘上的所有关联文件)。

旧版本:
在 10.1 版本中,此工具的各个参数均发生了变化。 在 10.1 版本之前使用该工具编写的模型或脚本均必须经过修改才能在 10.1 版本中使用。

使用方法

  • 由于这是一种不可恢复的操作,因此只有确定不再使用缓存时,方可执行此项操作。 如果要删除切片但保留缓存文件夹结构和切片方案,请使用管理地图服务器缓存切片工具,并将更新模式设置为 DELETE_TILES。

  • 此工具运行后,将重新启动服务。

语法

arcpy.server.DeleteMapServerCache(input_service, {num_of_caching_service_instances})
参数说明数据类型
input_service

要删除缓存的地图或影像服务。

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

Image Service; Map Server
num_of_caching_service_instances
(可选)

专用于运行该工具的 System/CachingTools 服务实例的总数。 您可以通过 ArcGIS Server 的管理连接,使用服务编辑器窗口,增加 System/CachingTools 服务的每台计算机的最大实例数设置。 确保您的服务器计算机可以支持所选数量的实例。

删除地图服务器缓存工具至少需要两个实例才能成功运行。

Long

派生输出

名称说明数据类型
out_job_url

输出 URL。

String

代码示例

DeleteMapServerCache 示例(独立脚本)

在本例中,将使用 DeleteMapServerCache 删除名为 Rainfall 的地图服务的一个缓存。

# Name: DeleteMapServerCache.py
# Description: The following stand-alone script demonstrates how to delete map server cache
#              tiles if the corresponding cache schema or tiles has been created
# Requirements: os, sys, time & traceback modules

# 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 variables for mapservice properties
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
serviceName = "Rainfall.MapServer"
inputService = connectionFile + "\\" + server + "\\" + serviceName
numOfCachingServiceInstances = 2


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')

# To Recreate all the tiles for the default number of scales generated
try:
    starttime = time.clock()
    result = arcpy.DeleteMapServerCache_server(inputService,
                                               numOfCachingServiceInstances)
    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 cache tiles & schema for mapservice " + serviceName
    "\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)


print "Deleted Map server Cache Tiles "

report.close()

环境

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

许可信息

  • Basic: 是
  • Standard: 是
  • Advanced: 是

相关主题

  • 缓存工具集概述

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

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