Exportar memoria caché de servidor de mapas (Servidor)

Resumen

Exporta teselas desde una memoria caché de mapa a una carpeta del disco. Las teselas se pueden importar a otras memorias caché o se puede acceder a ellas desde ArcGIS Desktop como un dataset ráster, de manera independiente del servicio principal.

Uso

Sintaxis

ExportMapServerCache_Server (server_name, object_name, data_frame, target_cache, {export_extent}, {levels}, thread_count, storage_format_type, {export_feature_class})
ParámetroExplicaciónTipo de datos
server_name

El equipo de ArcGIS Server que aloja el servicio cuyas teselas de memoria caché se exportarán.

String
object_name

El servicio de mapas cuyas teselas se exportarán.

String
data_frame

El marco de datos de origen para el servicio de mapas.

String
target_cache

La carpeta a la cual se exportará la memoria caché. Esta carpeta no tiene que ser un directorio de memoria caché de un servidor registrado.

Folder
export_extent
(Opcional)

Una extensión rectangular que define las teselas que se exportarán. Por defecto, se puede ver la extensión completa del mapa fuente del servicio. Observe el parámetro opcional de esta herramienta que le permite restringir alternativamente la exportación de teselas a un límite de clase de entidad.

Extent
levels
[levels,...]
(Opcional)

Lista de niveles de escala a los cuales se exportarán las teselas.

Double
thread_count

La cantidad de instancias de servicio de mapas que se utilizará cuando se exporte la memoria caché. Por defecto, se utilizará la cantidad máxima de instancias permitidas (el valor predeterminado para un servicio de ArcGIS Server es 2). Si tiene más potencia en el servidor, puede aumentar la cantidad máxima de instancias permitidas en las Propiedades del servicio y después puede aumentar este parámetro cuando ejecuta la herramienta.

Long
storage_format_type

El formato de almacenamiento de la memoria caché exportada.

  • COMPACTOLas teselas se agrupan en paquetes de archivos para ahorrar espacio en disco y permitir una copia más rápida de las memorias caché.
  • EXPANDIDOCada tesela se almacena como un archivo individual (del modo en que se guardaban las memorias caché antes de ArcGIS Server 10).
String
export_feature_class
(Opcional)

Una clase de entidad poligonal que define a dónde se exportan las teselas desde la memoria caché. Es útil si desea exportar áreas con formas irregulares.

Feature Class

Ejemplo de código

Este ejemplo utiliza ExportMapServerCache para exportar la memoria caché de todo el mapa para cuatro escalas.

# Name: ExportMapServerCache.py
# Description: The following stand-alone script demonstrates how to export cache
#               for default number of scales of a service to a destination folder
# Requirements: os, sys, time and 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
server = "MyServer"
service = "Rainfall"
dataFrame = "" 
exportExtents = ""
scaleValues = [500000,250000,125000,64000]
destinationCacheDir = "C:/data/temp"
threadCount = "2"
storageFormat = "Exploded"

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

# use "scaleValues[0]","scaleValues[-1]","scaleValues[0:3]"

try:
    starttime = time.clock()
    result = arcpy.ExportMapServerCache_server(server, service, dataFrame,
                                      destinationCacheDir, threadCount ,
                                      storageFormat, exportExtents,
                                      scaleValues)
    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 " Exported cache successfully for mapservice " + service + " to "
    + destinationCacheDir + " 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)
    
print "Exported Map server Cache "

report.close()

Este ejemplo utiliza ExportMapServerCache para exportar una memoria caché basada en los límites de una clase de entidad.

# Name: ExportMapServerCache.py
# Description: The following stand-alone script demonstrates how to export cache
#               for default number of scales of a service to a destination folder
# Requirements: os, sys, time and 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
server = "MyServer"
service = "Rainfall"
dataFrame = "" 
exportExtents = ""
scaleValues = [500000,250000,125000,64000]
destinationCacheDir = "C:/data/temp"
threadCount = "2"
storageFormat = "Exploded"

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

# use "scaleValues[0]","scaleValues[-1]","scaleValues[0:3]"

try:
    starttime = time.clock()
    result = arcpy.ExportMapServerCache_server(server, service, dataFrame,
                                      destinationCacheDir, threadCount ,
                                      storageFormat, exportExtents,
                                      scaleValues)
    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 " Exported cache successfully for mapservice " + service + " to "
    + destinationCacheDir + " 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)
    
print "Exported Map server Cache "

report.close()

Entornos

Esta herramienta no utiliza ningún entorno de geoprocesamiento

Temas relacionados

Información de licencia

ArcView: Sí
ArcEditor: Sí
ArcInfo: Sí

7/11/2012