マップ サービス キャッシュのタイルを管理(Manage Map Server Cache Tiles) (サーバ)
サマリ
タイルを既存のマップ サービス キャッシュ内に作成し、更新します。このツールは、新しいタイルの作成、欠落したタイルの補充、古くなったタイルの上書き、またはタイルの削除に使用します。
使用法
このツールは、広大な地理的範囲または非常に大きな縮尺をカバーするキャッシュを行うために、実行するのに時間がかかることがあります。もしツールがキャンセルされると、タイルの作成は停止しますが、既存のタイルは削除されません。これは、時間切れになったらツールをキャンセルすることができ、そして [Recreate Empty Tiles] の更新モードを使用して、後で同じキャッシュで再実行ができることを意味します。作業を中断したところから再開するための別の方法は、下記の「ignore_status」の説明の中に示した状態追跡を使用します。
構文
| パラメータ | 説明 | データ タイプ |
server_name |
タイルを更新するマップ サービスをホストする、ArcGIS Server コンピュータ。 | String |
object_name |
タイルを更新するマップ サービス。 注意:このツールを使用する前に、マップ サービスのタイル スキーマが定義されているか確認してください。[サービス プロパティ] ダイアログ ボックスの [キャッシュ] タブ、または [マップ サービス キャッシュの作成(Create Map Server Cache)] ツールを使用してタイル スキーマを作成することができます。 | String |
data_frame |
マップ サービス用のソース データ フレーム。 | String |
Layer [Layer,...] |
キャッシュから削除する対象のレイヤ。 | String |
levels |
このツールの実行中に、更新モードにしたがって、タイルを作成または削除する縮尺レベル。 | Double |
update_mode |
キャッシュを更新するときのモードを選択します。次の 3 つのモードがあります。
| String |
constraining_extent (オプション) |
更新モードにしたがって、タイルを作成または削除する、矩形の表示範囲枠 | Extent |
thread_count (オプション) |
このツールの実行時に使用するマップ サービスのインスタンス数。デフォルトでは、インスタンスの最大数が使用されます(ArcGIS Server サービスの場合、デフォルトは 2 です)。サーバ リソースに余裕がある場合は、最大許容インスタンス数を引き上げることができます。それには、サービスの [サービス プロパティ] ダイアログ ボックスで最大インスタンス数を引き上げてから、ツールの実行時にこのパラメータ値を増分してください。 | Long |
Antialiasing (オプション) |
これは除外された非推奨のパラメータです。タイル スキーマのアンチエイリアス プロパティは、アンチエイリアスをキャッシュに適用するかを決定します。 | Boolean |
update_feature_class (オプション) |
ポリゴン フィーチャクラスを使用して、フィーチャクラス内のフィーチャの範囲に基づいて、タイルを管理(作成、更新、削除)することができます。たとえば 1 つの国をキャッシュしている場合は、主要都市部のフィーチャクラスを指定することができます。そうすることで、それらの都市部をカバーするタイルだけをサーバに事前に作成するよう要求できます。残りのエリアは、クライアントによってリクエストされたときにオンデマンドでキャッシュすることができます。これにより、郊外地域のタイルの作成に費やす時間とディスク領域を節約することができます。 | Feature Class |
ignore_status (オプション) | このパラメータを使用すると、フィーチャクラスの境界線に基づいてタイルを作成している場合に、キャッシングのステータスを追跡することができます(update_feature_class パラメータを参照)。
| Boolean |
コードのサンプル
この例では、[Recreate All Tiles] オプションを使用して、キャッシュ内のすべてのタイルを作成または更新します。
# ManageMapServerCacheTiles example (stand-alone script)
# Name: ManageMapServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to Recreate all
# cache tiles for the default number of scales in the cache tiling
# scheme.
# 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 = ""
inputLayers = ""
scaleValues = ""
extents = ""
updateMode = "Recreate All Tiles"
antialiasing = "NONE"
threadCount = "2"
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.ManageMapServerCacheTiles_server(server, service, dataFrame,
inputLayers, scaleValues, updateMode,
extents, threadCount ,Antialiasing,
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 cache tiles for given schema 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)
report.write(e.message)
report.close()
print "Created Map server Cache Tiles "
この例では、[Recreate Empty Tiles] オプションを使用して、空のタイルを一部の縮尺で更新します。
# ManageMapServerCacheTiles example (stand-alone script)
# Name: ManageMapServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to Recreate all
# cache tiles for the default number of scales in the cache tiling
# scheme.
# 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 = ""
inputLayers = ""
scaleValues = ""
extents = ""
updateMode = "Recreate All Tiles"
antialiasing = "NONE"
threadCount = "2"
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.ManageMapServerCacheTiles_server(server, service, dataFrame,
inputLayers, scaleValues, updateMode,
extents, threadCount ,Antialiasing,
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 cache tiles for given schema 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)
report.write(e.message)
report.close()
print "Created Map server Cache Tiles "
この例では、タイルの更新をフィーチャクラスの境界に固定します。
# ManageMapServerCacheTiles example (stand-alone script)
# Name: ManageMapServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to Recreate all
# cache tiles for the default number of scales in the cache tiling
# scheme.
# 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 = ""
inputLayers = ""
scaleValues = ""
extents = ""
updateMode = "Recreate All Tiles"
antialiasing = "NONE"
threadCount = "2"
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.ManageMapServerCacheTiles_server(server, service, dataFrame,
inputLayers, scaleValues, updateMode,
extents, threadCount ,Antialiasing,
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 cache tiles for given schema 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)
report.write(e.message)
report.close()
print "Created Map server Cache Tiles "
