arcpy.server.GenerateMapServerCacheTilingScheme(in_map, tile_origin, output_tiling_scheme, num_of_scales, scales, dots_per_inch, tile_size, {ready_to_serve_format}, {output_folder})
|
名前
|
説明
|
データ タイプ
|
|
in_map
|
タイル スキーマに使用される現在のマップまたは既存の .mxd ファイル。
|
Map
|
|
tile_origin
|
ソース データ フレームの空間参照座標でのタイル スキーマの原点 (左上隅)。
|
Point
|
|
output_tiling_scheme
|
作成されるタイル スキーマ ファイルのパスとファイル名。
|
File
|
|
num_of_scales
|
タイル スキーマに含める縮尺レベルの数。
|
Long
|
|
scales
[scales,...]
|
タイル スキーマに含める縮尺レベル。 これらは分数としては表されません。 代わりに、500 を使用して 1:500 などの目盛を表します。
|
Value Table
|
|
dots_per_inch
|
対象となる出力デバイスの 1 インチあたりのドット数 (DPI)。 指定した DPI が出力デバイスの解像度と一致していない場合、その縮尺のマップ タイルは正しく表示されません。 デフォルト値は 96 です。
|
Long
|
|
tile_size
|
ピクセル単位でキャッシュ タイルの幅と高さを指定します。 パフォーマンスと管理容易性の最適なバランスを得るには、256 x 256 または 512 x 512 の標準寸法から外れないようにしてください。
128 x 128—キャッシュ タイルの幅と高さは 128 x 128 ピクセルです。
256 x 256—キャッシュ タイルの幅と高さは 256 x 256 ピクセルです。 これがデフォルトです。
512 x 512—キャッシュ タイルの幅と高さは 512 x 512 ピクセルです。
1024 x 1024—キャッシュ タイルの幅と高さは 1024 x 1024 ピクセルです。
|
String
|
|
ready_to_serve_format
(オプション)
|
使用されるキャッシュ スキーマのファイル形式と、オープンなタイル パッケージ仕様を使用して生成されるかどうかを指定します。
|
Boolean
|
|
output_folder
(オプション)
|
キャッシュ スキーマと iteminfo ファイルが JSON 形式で作成されるフォルダーの場所。
|
Folder
|
コードのサンプル
GenerateMapServerCacheTilingScheme の例 1 (XML 形式)
次の例では、XML 形式でマップ キャッシュ タイル スキーマを作成します。
# Name: GeneateMapServerCacheTilingScheme.py
# Description: The following stand-alone script demonstrates how to create map
# server cache schema using a given map document at a given
# "pathForOutputXml"
# Requirements: os, sys, time & traceback modules
# Any line that begins with a pound sign is a comment and will not be run
# 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 sys
import time
# Set environment settings
env.workspace = "E:/path/to/myfolder"
# List of input variables for map service properties
# Reference map to use for cache tiling sceheme generation
aprx = arcpy.mp.ArcGISProject(r"E:\Data\path\to\myAPRX.aprx")
mapDocument = aprx.listMaps("myMapName")[0]
outputTilingScheme = "E:/path/to/myschema.xml"
tileOrigin = ""
numOfScales = "4"
scales = "4000000,2000000,100000,50000"
tileSize = "256 x 256"
dotsPerInch = "96"
# print results of the script to a report
file = r'E:\path\to\myreport.txt'
report = open(file,'w')
try:
#starttime = time.clock()
result = arcpy.server.GenerateMapServerCacheTilingScheme(mapDocument,
tileOrigin, outputTilingScheme,
numOfScales, scales,
dotsPerInch, tileSize)
#print messages to a file
while result.status < 4:
time.sleep(0.2)
resultValue = result.getMessages()
report.write ("completed " + str(resultValue))
print(" Created MapServer cache tiling schema successfully using" + \
mapDocument + " at "+ outputTilingScheme )
except Exception as 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(str(e))
print("Created Map server Cache Tiling schema ")
report.close()
GenerateMapServerCacheTilingScheme の例 2 (JSON 形式)
次の例では、JSON 形式でマップ キャッシュ タイル スキーマを作成します。
# Name: GeneateMapServerCacheTilingScheme.py
# Description: The following stand-alone script demonstrates how to create map
# server cache schema in ready to serve format using a given map document at a given
# folder
# Requirements: os, sys, time & traceback modules
# Any line that begins with a pound sign is a comment and will not be run
# 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 sys
import time
# Set environment settings
env.workspace = "E:/path/to/myfolder"
# List of input variables for map service properties
# Reference map to use for cache tiling sceheme generation
aprx = arcpy.mp.ArcGISProject(r"E:\Data\path\to\myAPRX.aprx")
mapDocument = aprx.listMaps("myMapName")[0]
outputTilingScheme = "None"
tileOrigin = ""
numOfScales = "4"
scales = "4000000,2000000,100000,50000"
tileSize = "256 x 256"
dotsPerInch = "96"
ready_to_serve_format = "READY_TO_SERVE_FORMAT"
output_folder = "E:\\path\\to\\myfolder"
# print results of the script to a report
file = r'E:\path\to\myreport.txt'
report = open(file,'w')
try:
#starttime = time.clock()
result = arcpy.server.GenerateMapServerCacheTilingScheme(mapDocument,
tileOrigin, outputTilingScheme,
numOfScales, scales,
dotsPerInch, tileSize,
ready_to_serve_format,
output_folder)
#print messages to a file
while result.status < 4:
time.sleep(0.2)
resultValue = result.getMessages()
report.write ("completed " + str(resultValue))
print(" Created MapServer cache tiling schema successfully using" + \
mapDocument + " at "+ outputTilingScheme )
except Exception as 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(str(e))
print("Created Map server Cache Tiling schema ")
report.close()