arcpy.server.ManageMapServerCacheTiles(input_service, scales, update_mode, {num_of_caching_service_instances}, {area_of_interest}, {update_extent}, {wait_for_job_completion}, {portal_url})
|
名前
|
説明
|
データ タイプ
|
|
input_service
|
キャッシュ タイルを更新する Web タイル レイヤー、Web イメージ レイヤーまたはマップ イメージ レイヤー。
|
Image Service; Map Server
|
|
scales
[scales,...]
|
タイルを作成する縮尺レベルのリスト。
|
Double
|
|
update_mode
|
キャッシュの更新に使用されるモードを指定します。
RECREATE_EMPTY_TILES—空のタイルだけを作成します。 既存のタイルは未変更のままです。 このオプションは、ArcGIS Online に公開された Web タイル レイヤーでは使用できません。
RECREATE_ALL_TILES—既存のタイルを置き換え、範囲が変更された場合は新しいタイルを追加します。
DELETE_TILES—タイルはキャッシュから削除されます。 キャッシュ フォルダー構造は削除されません。
|
String
|
|
num_of_caching_service_instances
(オプション)
|
このツールの実行に専用で使用する、System/CachingTools サービスのインスタンスの合計数。 デフォルト値である -1 を使用した場合、ArcGIS Enterprise 設定のすべてのキャッシュ ツール インスタンスが使用されます。 使用するキャッシュ ツール インスタンスの数を減らすには値を小さくします。
ArcGIS Server への管理者接続で使用できる サービス エディター ウィンドウで、System/CachingTools サービスの コンピューターごとのインスタンスの最大数 設定を増やすことができます。 選択したインスタンス数を、サーバー コンピューターでサポートできることを確認してください。
スタンドアロン サーバーに接続するとき、デフォルトのインスタンス数は、キャッシュ ツール サービスの インスタンスの最大数 設定の値と同じです。
|
Long
|
|
area_of_interest
(オプション)
|
タイルを作成または削除する範囲を制限する対象地域。 このパラメーターは、不規則な形状のエリアでタイルを管理する場合に便利です。 一部のエリアだけを事前にキャッシュして、表示頻度の低いエリアをキャッシュしない場合にも有効です。
このパラメーターに値を指定しない場合、デフォルト値のマップ全体表示が使用されます。
|
Feature Set
|
|
update_extent
(オプション)
|
update_mode パラメーターの値に従って、タイルを作成または削除するのに使用される矩形の範囲。 update_extent と area_of_interest 両方のパラメーター値を指定した場合、area_of_interest の値が使用されます。
MAXOF - すべての入力データの最大範囲が使用されます。
MINOF - すべての入力データに共通する最小領域が使用されます。
DISPLAY - 範囲は、表示範囲と同じになります。
レイヤー名 - 指定されたレイヤーの範囲が使用されます。
Extent オブジェクト - 指定されたオブジェクトの範囲が使用されます。
スぺース区切りの座標文字列 - 指定された文字列の範囲が使用されます。 座標値は、x-min、y-min、x-max、y-max という順序で表記されます。
|
Extent
|
|
wait_for_job_completion
(オプション)
|
キャッシュ ジョブが ArcGIS Online または Portal for ArcGIS 上で実行されているとき、このツールを実行し続けるかどうかを指定します。
WAIT—キャッシュ ジョブが ArcGIS Online または Portal for ArcGIS 上で実行されているとき、このツールを実行し続けます。 このオプションを使用すると、いつでも詳細な進行状況のレポートをリクエストして、表示されるジオプロセシング メッセージを確認できます。 これがデフォルトです。 Python スクリプトでは、このオプションを使用することをおすすめします。
DO_NOT_WAIT—ジョブがサーバーに送信され、他のジオプロセシング タスクを実行できます。 サービスを公開するときにキャッシュを自動的に作成する場合にこのオプションを使用します。 作成する別のキャッシュでこのオプションを設定することもできます。
|
Boolean
|
|
portal_url
(オプション)
|
ポータルの URL。
|
String
|
派生した出力
|
名前
|
説明
|
データ タイプ
|
|
out_job_url
|
出力 URL。
|
String
|
コードのサンプル
ManageMapServerCacheTiles の例 (スタンドアロン スクリプト)
以下は、対象エリアを使用してマップまたはイメージ サービスですべてのキャッシュ タイルを再作成する方法を示したものです。
# Name: ManageMapServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to Recreate all
# cache tiles for for a map or image service using an area of interest.
# This tool works for weblayers published to ArcGIS Enterprise and ArcGIS Online.
# and for map and image services on a stand alone ArcGIS Server
# Example: This sample script updates map cache tiles.
import arcpy
from arcpy import env
import sys
import time
import datetime
# Set environment settings
env.workspace = "C:/data"
# Sign in to ArcGIS Enterprise
myPortal= "https://MyPortal.domain.com/portalwebadaptor"
arcpy.SignInToPortal(myPortal, "siteadminValue", "siteadminPassword")
myServer="https://Myserver.domain.com/serverwebadaptor"
serviceName= "SampleWorldCities"
serviceType= "MapServer"
myPortalServiceURL = (myServer + "/" + "rest/services" +"/" + serviceName + "/"
+ serviceType)
### Sign in to ArcGIS Online
##myPortal= "https://www.arcgis.com"
##arcpy.SignInToPortal(myPortal, "MyUserName", "MyPassword")
##serviceRestUrl="https://www.arcgis.com/tiles/orgid"
##serviceName= "MyServiceName"
##serviceType= "MapServer"
##myPortalServiceURL = (serviceRestUrl + "/" + "arcgis/rest/services" +"/" + serviceName + "/"
## + serviceType)
# Stand alone ArcGIS Server
##target_server_connection = r"C:\share\python3\arcgis on MyServer.ags"
##serviceName= "MyServiceName"
##serviceType= ".MapServer"
##myPortalServiceURL = (target_server_connection + "\\" + serviceName + serviceType)
print (myPortalServiceURL)
#variables for reporting
currentTime = datetime.datetime.now()
arg1 = currentTime.strftime("%H-%M")
arg2 = currentTime.strftime("%Y-%m-%d %H:%M")
file = r'C:\test\report_%s.txt'% arg1
# List of input variables for map or image service
##scales = [591657527.591555,295828763.79577702,147914381.89788899]
scales = [73957190.948944,36978595.474472]
numOfCachingServiceInstances = 8
updateMode = "RECREATE_ALL_TILES"
areaOfInterest = ""
waitForJobCompletion = "WAIT"
updateExtents = ""
portalURL =""
# Print results of the script to a report
report = open(file,'w')
try:
result = arcpy.server.ManageMapServerCacheTiles(myPortalServiceURL, scales, updateMode,
numOfCachingServiceInstances, areaOfInterest,
updateExtents, waitForJobCompletion,
portalURL)
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 " + serviceName )
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
report.write("Failed at step 1 \n" "Line %i" % tb.tb_lineno)
report.write(str(e))
report.close()
print ("Completed update of cache tiles for " + serviceName)