ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS Desktop

完全なプロ仕様の GIS

ArcGIS Enterprise

エンタープライズ GIS

ArcGIS Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

ArcMap

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • エクステンション

マップ サービス キャッシュのタイルを管理 (Manage Map Server Cache Tiles)

  • 概要
  • 使用法
  • 構文
  • コードのサンプル
  • 環境
  • ライセンス情報

概要

既存の Web タイル レイヤー キャッシュ (ArcGIS Enterprise または ArcGIS Online)、ArcGIS Enterprise の Web マップ イメージ レイヤー、およびスタンドアロン サーバーのキャッシュ済みマップまたはイメージ サービスにタイル作成し、更新します。 このツールは、新しいタイルの作成、欠落したタイルの補充、古くなったタイルの上書き、またはタイルの削除に使用します。

使用法

  • このツールは、広大な地理的範囲または非常に大縮尺をカバーするキャッシュを行う場合、実行に時間がかかることがあります。 もしツールがキャンセルされると、タイルの作成は停止しますが、既存のタイルは削除されません。 つまり、時間がないときにはツールをキャンセルし、後で [更新方法] パラメーターを [空タイルを再作成] (Python では update_mode = "RECREATE_EMPTY_TILES") に設定して、同じキャッシュに対して再度ツールを実行することができます。

構文

arcpy.server.ManageMapServerCacheTiles(input_service, scales, update_mode, {num_of_caching_service_instances}, {area_of_interest}, {update_extent}, {wait_for_job_completion})
パラメーター説明データ タイプ
input_service

キャッシュ タイルを更新する Web タイル レイヤーまたはマップ イメージ レイヤー。

Image Service; MapServer
scales
[scales,...]

このツールの実行中に、update_mode に従って、タイルを作成または削除する縮尺レベル。

Double
update_mode

キャッシュを更新するときのモード。

  • RECREATE_EMPTY_TILES —空のタイルだけを作成します。 既存のタイルは未変更のままです。 このオプションは、ArcGIS Online に公開された Web タイル レイヤーでは使用できません。
  • RECREATE_ALL_TILES —既存のタイルを置き換え、範囲が変更された場合は新しいタイルを追加します。
  • DELETE_TILES —タイルはキャッシュから削除されます。 キャッシュ フォルダー構造は削除されません。
String
num_of_caching_service_instances
(オプション)

このツールの実行に専用で使用する、System/CachingTools サービスのインスタンス数の合計。 ArcGIS Server への管理者接続を通して使用できる [サービス エディター] ウィンドウで、System/CachingTools サービスの [コンピューターごとのインスタンスの最大数] 設定の値を大きく変更することができます。 選択したインスタンス数を、サーバー コンピューターでサポートできることを確認してください。

スタンドアロン サーバーに接続する際は、インスタンスのデフォルトの数字とキャッシュ ツール サービスの [インスタンスの最大数] 設定の値が等しくなるようにします。

Long
area_of_interest
(オプション)

対象エリアを定義して、タイルを作成または削除する範囲を制限します。 このパラメーターは、不規則な形状のエリアでタイルを管理する場合に便利です。 一部のエリアだけを事前にキャッシュして、表示頻度の低いエリアをキャッシュしない場合にも有効です。

このパラメーターに値を指定しない場合、デフォルトのマップ全体表示が使用されます。

Feature Set
update_extent
(オプション)

update_mode パラメーターの値に従って、タイルを作成または削除する矩形の範囲。 update_extent と area_of_interest の両方に値を指定することはお勧めしません。 両方のパラメーターに値を設定した場合は、area_of_interest の値が使用されます。

Extent
wait_for_job_completion
(オプション)

このパラメーターを指定すると、ポータルで実行されているキャッシュ ジョブの進行状況を確認できます。

  • WAIT —キャッシュ ジョブを Portal for ArcGIS または ArcGIS Online 上で実行しながら、このツールは引き続き Python ウィンドウで実行されます。 このオプションを利用すると、いつでも詳細な進行状況のレポートをリクエストして、表示されるジオプロセシング メッセージを確認できます。 これがデフォルトのオプションです。 Python スクリプトでは、このオプションを使用することをお勧めします。
  • DO_NOT_WAIT —このジオプロセシング ツールはジョブをサーバーに送信し、他のジオプロセシング タスクを実行できるようにします。 このオプションは、サービスを公開するときにキャッシュを自動的に作成するよう選択した場合に使用されます。また、作成する別のキャッシュで、このオプションを設定することもできます。
Boolean

派生した出力

名前説明データ タイプ
out_job_url

出力 URL。

String

コードのサンプル

ManageMapServerCacheTiles の例 (スタンドアロン スクリプト)

RECREATE_ALL_TILES オプションを使用して、キャッシュ内のすべてのタイルを作成または更新します。

# Name: ManageMapServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to Recreate all 
# cache tiles for the 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
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
serviceName = "Rainfall.MapServer"
inputService = connectionFile + "\\" + server + "\\" + serviceName
scales = [500000,250000,125000,64000]
numOfCachingServiceInstances = 2
updateMode = "RECREATE_ALL_TILES"
areaOfInterest = ""
waitForJobCompletion = "WAIT"
updateExtents = ""

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(inputService, scales,
                                                    updateMode,
                                                    numOfCachingServiceInstances,
                                                    areaOfInterest, updateExtents,
                                                    waitForJobCompletion)
    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 " +\
    serviceName + " in " + str(elapsedtime) + " sec 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 の例 2 (スタンドアロン スクリプト)

RECREATE_EMPTY_TILES オプションを使用して、一部の縮尺の空のタイルを更新します。

# Name: ManageMapServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to Recreate  
# empty tiles for one of 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
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
serviceName = "Rainfall.MapServer"
inputService = connectionFile + "\\" + server + "\\" + serviceName
scales = [500000,250000,125000,64000]
numOfCachingServiceInstances = 2
updateMode = "RECREATE_EMPTY_TILES"
areaOfInterest = ""
waitForJobCompletion = "WAIT"
updateExtents = ""
cacheDir = "c:\\arcgisserver\\arcgiscache\\"

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 "scales[0]","scales[-1]","scales[0:3]"

try:
    starttime = time.clock()
    result = arcpy.ManageMapServerCacheTiles_server(inputService, scales[-1],
                                                    updateMode, numOfCachingServiceInstances,
                                                    areaOfInterest, updateExtents,
                                                    waitForJobCompletion)
    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 scale =" + str(scales[-1]) + "for " +\
    serviceName + " at " + cacheDir + " in " + str(elapsedtime) +\
    " sec 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 "Rereated Map server Cache Tiles for scale = " + str(scaleValues[-1])
ManageMapServerCacheTiles の例 3 (スタンドアロン スクリプト)

対象エリア パラメーターを使用してタイルを更新します。

# Name: ManageMapServerCacheTiles.py
# Description: The following stand-alone script demonstrates how to Recreate all
# tiles using given feature class.

# 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
import os
import sys
import time
import datetime
import traceback
import string

# Set environment settings
arcpy.env.workspace = "C:/data"

# List of input variables for map service properties
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
serviceName = "Rainfall.MapServer"
inputService = connectionFile + "\\" + server + "\\" + serviceName
scales = [500000,250000,125000,64000]
numOfCachingServiceInstances = 2
updateMode = "RECREATE_ALL_TILES"
areaOfInterest = "C:/data/shp/CaTxFlMaMin.shp"
waitForJobCompletion = "WAIT"
updateExtents = ""

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 "scales[0]","scales[-1]","scales[0:3]"

try:
    starttime = time.clock()
    result = arcpy.ManageMapServerCacheTiles_server(inputService, scales[-1],
                                                    updateMode,
                                                    numOfCachingServiceInstances,
                                                    areaOfInterest, updateExtents,
                                                    waitForJobCompletion)                                           
    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 scale =" + str(scales[-1]) + "for " +\
    serviceName + "at " + cacheDir + " using specified feature class " +\
    areaOfInterest + " in " + str(elapsedtime) + " sec on " + arg2

except Exception, e:
    # If an error occurred, print line number and error message
    tb = sys.exc_info()[2]
    report.write("Failed at \n" "Line %i" % tb.tb_lineno)
    report.write(e.message)

report.close()     
print "Rereated Map server Cache Tiles"
print "for scale = " + str(scaleValues[-1]) + " using area of Interest"

環境

  • 現在のワークスペース

ライセンス情報

  • Basic: はい
  • Standard: はい
  • Advanced: はい

関連トピック

  • キャッシュ ツールセットの概要

ArcGIS Desktop

  • ホーム
  • ドキュメント
  • サポート

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • Esri ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
ご意見・ご感想をお寄せください。
Copyright © 2021 Esri. | プライバシー | リーガル