Manage Globe Server Cache Tiles (Server)

Summary

Creates and updates tiles in an existing globe service cache. This tool is used to create new tiles or to replace missing tiles, overwrite outdated tiles, or add new tiles. All these actions can be defined by rectangular extents or by a polygon feature class. When creating new tiles, you can choose whether to create only empty tiles or re-create all tiles.

Usage

Syntax

ManageGlobeServerCacheTiles_Server (server_name, object_name, {update_extent}, in_layers, {thread_count}, update_mode, {update_feature_class}, {ignore_status})
ParameterExplanationData Type
server_name

The ArcGIS Server machine hosting the globe service whose tiles you are managing.

String
object_name

The globe service whose tiles will be modified.

String
update_extent
(Optional)

Rectangular extent at which tiles should be created or deleted, depending on the Update Mode. You can type the extent values or choose an extent from an existing data source.

Extent
in_layers
[in_layers,...]

Select the layers to include in the cache.

For each layer, you need to provide a level_from, which is the level of detail at which you would like to begin caching the layer, and a level_to, which is the level of detail at which you would like to end caching the layer. If the smallest and largest levels of detail are used for level_from and level_to, respectively, a full cache will be built for the layer.

Value Table
thread_count
(Optional)

Number of globe service instances to use while running this tool. By default the maximum allowable number of instances will be used (default for an ArcGIS Server service is 2) . If you have more server power, you can raise the maximum allowable number of instances in the Service Properties, then raise this parameter when you run the tool.

Long
update_mode

Choose a mode for updating the cache. The two modes are:

  • Recreate Empty TilesOnly tiles that are empty will be created. Existing tiles will be left unchanged.
  • Recreate All TilesAll tiles, including existing tiles, will be replaced. Additionally, new tiles will be added if a layer's data extent has changed or new layers have been added to the globe service and listed in this tool.
String
update_feature_class
(Optional)

You can use a polygon feature class to manage tiles (create/update) based on the extents of features in a feature class. For example, if you are caching a country, you might supply a feature class of major urban areas. By doing so, you are requesting that the server only pre-create tiles that cover those urban areas. The rest of the areas can be cached on demand when requested by clients. This can save you time and disk space that would be consumed by creating unneeded tiles in rural areas.

Feature Class
ignore_status
(Optional)

This parameter allows you to track the status of your caching if you are creating tiles based on feature class boundaries (see the update_feature_class parameter).

  • IGNORE_COMPLETION_STATUS_FIELDThe feature class's Completed field is ignored and tiles are created for all features in the feature class. This is the default.
  • TRACK_COMPLETION_STATUSThe feature class's Completed field is read (and created if it doesn't exist yet). Features marked No or null in this field are cached and marked Yes when caching has completed for the feature. Features already marked Yes in this field are not cached.
Boolean

Code Sample

This example creates a full cache for a globe service.

#ManageGlobeServerCacheTiles example (stand-alone script)

# Name: ManageGlobeServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to update the
#               globe map server cache tiles
# 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 values
# 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"
globeServerObject = "tstGlobeService"
inputLayers = ""
extents = ""
cacheDir = "C:\\arcgisserver\\arcgiscache\\GlobeCache"
threadCount = "2"
updateMode = "Recreate All Tiles"
pathToFeatureClass = ""
ignoreStatus = "IGNORE_COMPLETION_STATUS_FIELD"

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.ManageGlobeServerCacheTiles_server (server, globeServerObject, 
                                              extents, updateMode,
                                              inputLayers, threadCount,
                                              pathToFeatureClass,
                                              ignoreStatus)
    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 "Created the GlobeServer cache successfully for mapservice "
    + globeServerObject + "\n   at " + cacheDir + globeServerObject
    + " 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 "Created the globe server cache successfully"

Environments

This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: Requires 3D Analyst
ArcEditor: Requires 3D Analyst
ArcInfo: Requires 3D Analyst

5/9/2011