3D フィーチャクラス → ASCII(Feature Class Z to ASCII) (3D Analyst)
サマリ
XYZ、GENERATE、またはプロファイル形式で 3D フィーチャを ASCII テキスト ファイルにエクスポートします。
使用法
サポートされている入力には、ポイント、マルチポイント、ポリライン、およびポリゴン フィーチャがあります。
-
このツールは、ポリラインをプロファイル ASCII 出力形式にエクスポートすることもできます。プロファイル出力形式のテキスト ファイルには、Y として距離、X として Z 値が記録されます。プロファイル形式では、3D データを特殊なグラフ アプリケーションにエクスポートできます。
ラインまたはポリゴンを含むフィーチャクラスを XYZ 形式にエクスポートする場合、ファイル名がテンプレートとして使用されます。これは XYZ 形式が単純で、ファイルごとに 1 つのラインまたはポリゴンしかサポートしないためです。この制限は実際にはパート レベルにおよんでおり、そのためフィーチャが複数のパートを持つ場合、各パートは別々のファイルに書き込まれます。ファイルには、ダイアログ ボックスで指定した接頭辞と接尾辞が付けられ、各フィーチャの OID と、必要に応じて別の文字が追加されて、一意のファイル名が作られます。
出力浮動小数点値の桁数形式は、入力として定義することも、また、ソフトウェアが不要な末尾のゼロを削除して、使用可能な精度を維持するのに必要な桁数を決定する場合に、自動的に決定させることもできます。
構文
| パラメータ | 説明 | データ タイプ |
in_feature_class |
3D ポイント、マルチポイント、ポリライン、またはポリゴンの各フィーチャクラスが ASCII ファイルにエクスポートされます。 | Feature Layer |
output_location |
出力ファイルが書き込まれるフォルダ | Folder |
out_file |
出力ファイル名を指定します。 ラインまたはポリゴンを含むフィーチャクラスを XYZ 形式にエクスポートする場合、ファイル名がテンプレートとして使用されます。これは XYZ 形式が単純で、ファイルごとに 1 つのラインまたはポリゴンしかサポートしないためです。この制限は実際にはパート レベルにおよんでおり、そのためフィーチャが複数のパートを持つ場合、各パートは別々のファイルに書き込まれます。ファイルには、ダイアログ ボックスで指定した接頭辞と接尾辞が付けられ、各フィーチャの OID と、必要に応じて別の文字が追加されて、一意のファイル名が作られます。 | File; Folder |
format (オプション) |
ASCII ファイルの作成形式
| String |
delimiter (オプション) |
The field delimeter used in the text file.
| String |
decimal_format (オプション) |
出力ファイルに格納される有効桁数を決定する方法を指定します。
| String |
digits_after_decimal (オプション) |
[10 進表記] が FIXED に設定されているときに使用されます。これによって、出力ファイルに書き込まれる浮動小数点値の小数点以下の桁数が決定します。 | Long |
decimal_separator (オプション) | The decimal character used in the text file to differentiate the integer of a number from its fractional part.
| String |
コードのサンプル
The following sample demonstrates the use of this tool in the Python window:
import arcpy
from arcpy import env
arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.FeatureClassZToASCII_3d("LidarPts.shp", "", "ASCII_LidarPts.txt",
"GENERATE", "COMMA", "FIXED", 6, "DECIMAL_POINT")
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''****************************************************************************
Name: FeatureClassZToASCII Example
Description: This script demonstrates how to use the
FeatureClassZToASCII tool to create generate files for all
z-aware point features in a given workspace.
****************************************************************************'''
import arcpy
import exceptions, sys, traceback
from arcpy import env
try:
# Obtain a license for the ArcGIS 3D Analyst extension
arcpy.CheckOutExtension('3D')
# Set environment settings
env.workspace = 'C:/data'
# List all points in the target workspace
fcList = arcpy.ListFeatureClasses("*", "POINT")
if fcList:
# Set Local Variables
outFolder = "C:/output"
outFormat = "GENERATE"
delimeter = "SPACE"
decimal = "FIXED"
digits = 3
dec_sep = "DECIMAL_POINT"
for fc in fcList:
# Use Describe method to evaluate whether the feature class is z-aware
desc = arcpy.Describe(fc)
if desc.hasZ == True:
# Define the output file name by replacing '.shp' with _ascii.txt
outName = fc.replace('.shp', '') + "_ascii.txt"
#Execute FeatureClassZToASCII_3d
arcpy.FeatureClassZToASCII_3d(fc, outFolder, outName, outFormat, delimeter, decimal, digits, dec_sep)
else:
print "There are no feature classes in the " + env.workspace + " directory."
except arcpy.ExecuteError:
print arcpy.GetMessages()
except:
# Get the traceback object
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# Concatenate error information into message string
pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
.format(tbinfo, str(sys.exc_info()[1]))
msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
# Return python error messages for script tool or Python Window
arcpy.AddError(pymsg)
arcpy.AddError(msgs)