3D ASCII 文件转要素类 (3D Analyst)
摘要
将 3D 要素从一个或多个以 XYZ、XYZI 或 GENERATE 格式存储的 ASCII 文件导入到新要素类中。
插图
用法
语法
参数 | 说明 | 数据类型 |
input <input; input...> |
ASCII 文件或者包含 ASCII XYZ、XYZI(具有激光雷达强度)或 3-D GENERATE 格式数据的文件夹。如果指定了某个文件夹,则文件后缀参数将成为必选项,且所有与指定后缀具有相同扩展名的文件都将被使用。如果涉及多个文件,则这些文件的格式必须相同。 | Folder; File |
in_file_type | String | |
out_feature_class |
The output feature class. | Feature Class |
out_geometry_type |
输出要素类的几何类型。
| String |
z_factor (可选) |
The factor by which elevation values will be multiplied. This is typically used to convert Z linear units that match those of the XY linear units. The default is 1, which leaves elevation values unchanged. | Double |
input_coordinate_system (可选) |
输入数据的坐标系。默认为“未知坐标系”。如果已指定坐标系,则输出可能会(也可能不会)被投影到不同的坐标系中。这取决于地理处理环境是否具有为目标要素类位置而定义的坐标系。 | Coordinate System |
average_point_spacing (可选) |
输入点之间的平均平面距离。仅当将输出几何设置为 MULTIPOINT 时才可使用此参数,且其功能是提供一个平均值以将点归组到一起。结合每个形状限制的点数使用该值,可构造用于组合点的虚拟切片系统。切片系统的原点取决于目标要素类的属性域。指定目标要素类的水平单位的间距。 | Double |
file_suffix (可选) |
The suffix of the files to import from an input folder. This parameter is required when a folder is specified as input. | String |
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.Ascii3DToFeatureClass_3d("masspnts.txt", "GENERATE", "masspnts.shp", "POINT", 1, "Coordinate Systems/Projected Coordinate Systems/State Plane/NAD 1983 (Feet)/NAD 1983 StatePlane Massachusetts Mainland FIPS 2001 (Feet).prj")
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''**************************************************************************** Name: ASCII3D_to_Feature_Class Example Description: This script demonstrates how to use the ASCII3D_to_Feature_Class tool to create a point feature class from a set of text files in the specified workspace. ****************************************************************************''' # Import system modules` import arcpy from arcpy import env import exceptions, sys, traceback try: # Obtain a license for the ArcGIS 3D Analyst extension arcpy.CheckOutExtension("3D") # Set environment settings env.workspace = "C:/data" # Set Local Variables inFormat = "GENERATE" # Name of the output file outFC = "Pts_from_ASCII.shp" # Geometry of the output feature class outType = "POINT" zFactor = 1 # Coordinate system of the output feature class CS = "Coordinate Systems/Geographic Coordinate Systems/World/WGS 1984.prj" fileSuffix = "ascii.txt" decSep = "DECIMAL_POINT" # Specifies the decimal delimeter # Create list of ASCII files txtList = arcpy.ListFiles("*" + fileSuffix) # Verify the presence of TINs in the list if len(txtList) > 0: # Execute ASCII3D_to_Feature_Class arcpy.ASCII3DToFeatureClass_3d(txtList, inFormat, outFC, outType, zFactor, CS, fileSuffix, decSep) 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)