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

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

管理地图服务器缓存比例

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

描述

用于在 ArcGIS Enterprise 中的现有地图图像图层或独立服务器上的已缓存地图或影像服务中更新比例级别。 使用此工具可添加新比例或从缓存中删除现有比例。

使用方法

  • 在 ArcGIS Enterprise 中,输入服务参数是包含服务的 REST 端点的字符串。 确保 ArcGIS Enterprise 门户为活动门户。

    在独立 ArcGIS Server 中,输入服务参数是包含服务器和服务信息的字符串。 要构建字符串,请使用发布者或管理员凭据将 ArcGIS Server 连接文件 (.ags) 的完整路径添加到独立服务器上的服务名称,例如:"C:\path_to_the connection_file_of_standAloneServer\arcgis on MyServer.com_6443.ags\ServiceName.MapServer" 有关详细信息,请参阅连接到 GIS 服务器。

  • 如果从现有缓存中移除比例,此细节层次内的所有现有已缓存切片将永久删除。

    警告:

    如果要保留现有比例值则必须直接指定它们。 所有未指定的现有比例级别都将永久删除。 例如,如果您已经具有四个比例级别,而您希望再添加两个比例,请确保列表中共有六个比例。

语法

arcpy.server.ManageMapServerCacheScales(input_service, scales)
参数说明数据类型
input_service

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

Image Service; Map Server
scales
[scales,...]

将包含在已更新切片方案中的比例值。

Value Table

派生输出

名称说明数据类型
out_job_url

输出 URL。

String

代码示例

ManageMapServerCacheScales 示例(独立脚本)

在本例中,将地图缓存切片方案修改为包含四个比例。

# Name: ManageMapServerCacheScales.py
# Description: The following stand-alone script demonstrates how to add/delete
#               MapServer cache scales for a map service with an existing schema
#               
# 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 input variables for map service 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
scales = "250000;125000;64000;5250"

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.ManageMapServerCacheScales_server(inputService, scales) 
    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 "Updated the number of cache scales successfully for " + serviceName
    " 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 step 1 \n" "Line %i" % tb.tb_lineno)
    report.write(e.message)
report.close()
    
print "Updated Map server Cache scales "

环境

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

许可信息

  • 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. | 隐私政策 | 法律声明