Manage Map Server Cache Scales (Server)


Updates the scale levels in an existing cached map service. Use this tool to add new scales or delete existing scales from a map cache.



ManageMapServerCacheScales_Server (server_name, object_name, levels)
ParameterExplanationData Type

The ArcGIS Server machine hosting the service from which you want to remove cache scales.


The name of the map service from which you want to remove cache scales.


The scale values to be included in the updated tiling scheme.


You must specify existing scale values if you want to keep them. Any existing scale levels you do not specify in this tool will be permanently deleted. For example, if you have four existing scales and you wish to add two scales, make sure your final list has a total of six scales.

Value Table

Code Sample

This example modifies a map cache tiling scheme to contain four scales.

# ManageMapServerCacheScales example (stand-alone script)

# Name:
# 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
# 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
server = "MyServer"
service = "Rainfall"
scaleValues = "250000;125000;64000;5250"

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

    starttime = time.clock()
    result = arcpy.ManageMapServerCacheScales_server(server, service ,
    finishtime = time.clock()
    elapsedtime = finishtime - starttime

    #print messages to a file
    while result.status < 4:
    resultValue = result.getMessages()
    report.write ("completed " + str(resultValue))
    print "Updated the number of cache scales successfully for " + service
    + " 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)
print "Updated Map server Cache scales "


This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes