マップ サービス キャッシュのエクスポート(Export Map Server Cache) (サーバ)
サマリ
タイルをマップ キャッシュからディスク上のフォルダにエクスポートします。タイルは、他のキャッシュにインポートするか、または親のサービスから独立したラスタ データセットとして ArcGIS Desktop からアクセスすることができます。
使用法
-
このツールを実行する前に、タイルを格納するためのフォルダをディスク上に作成します。
構文
| パラメータ | 説明 | データ タイプ |
server_name |
エクスポートする側のキャッシュ タイルのサービスをホストしている ArcGIS Server コンピュータ。 | String |
object_name |
エクスポートする側のタイルを含むマップ サービス。 | String |
data_frame |
マップ サービス用のソース データ フレーム。 | String |
target_cache |
キャッシュのエクスポート先のフォルダ。このフォルダは、登録済みサーバ キャッシュ ディレクトリである必要はありません。 | Folder |
export_extent (オプション) |
エクスポートするタイルを定義する矩形の表示範囲。デフォルトでは、表示範囲は、サービス ソース マップの全体表示に設定されます。このツールのオプション パラメータによって、フィーチャクラスの境界へのタイルのエクスポートが、代案として制限できるようになります。 | Extent |
levels [levels,...] (オプション) |
タイルのエクスポート先の縮尺レベルのリスト。 | Double |
thread_count |
キャッシュをエクスポートする間に使用するマップ サービス インスタンスの数。デフォルトでは、インスタンスの最大数が使用されます(ArcGIS Server サービスの場合、デフォルトは 2 です)。サーバ リソースに余裕がある場合は、最大インスタンス数を引き上げることができます。それには、[サービス プロパティ] で最大インスタンス数を引き上げてから、ツールの実行時にこのパラメータ値を増分してださい。 | Long |
storage_format_type |
エクスポートしたキャッシュの格納形式。
| String |
export_feature_class (オプション) |
タイルがキャッシュからエクスポートされる範囲を指定する、ポリゴン フィーチャクラス。これは不規則な形状のエリアをエクスポートする場合に便利です。 | Feature Class |
コードのサンプル
この例では、ExportMapServerCache を使用して、マップ キャッシュ全体を 4 つの縮尺でエクスポートします。
# 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()
この例では、ExportMapServerCache を使用して、フィーチャクラスの境界に基づいてマップ キャッシュをエクスポートします。
# 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()