ASCII 3D To Feature Class (3D Analyst)

Summary

Imports 3D features from one or more ASCII files stored in XYZ, XYZI, or GENERATE formats into a new feature class.

Learn more about how ASCII 3D To Feature Class (3D Analyst) works

Illustration

ASCII 3D To Feature Class example

Usage

Syntax

ASCII3DToFeatureClass_3d (input, in_file_type, out_feature_class, out_geometry_type, {z_factor}, {input_coordinate_system}, {average_point_spacing}, {file_suffix}, {decimal_separator})
ParameterExplanationData Type
input
<input; input...>

The ASCII files or folders containing data in ASCII XYZ, XYZI (with lidar intensity), or 3-D GENERATE format. If a folder is specified, the File Suffix parameter becomes required and all the files that have the same extension as the specified suffix will be used. If multiple files are involved, they need to be in the same format.

Folder; File
in_file_type
String
out_feature_class

The output feature class.

Feature Class
out_geometry_type

The geometry type of the output feature class.

  • MULTIPOINT—Only valid when points are input. Multipoints are recommended when you don’t intend to add any attribution on a per-point basis and especially when many thousands or millions of points are involved. This is the default.
  • POINT—Only valid when points are input.
  • POLYLINES—Only valid when polylines or polygons are input. If inputting polygons, you can use POLYLINES as output.
  • POLYGONS—Only valid when polygons are input.
String
z_factor
(Optional)

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
(Optional)

The coordinate system of the input data. The default is an Unknown Coordinate System. If specified, the output may or may not be projected into a different coordinate system. This depends the whether the geoprocessing environment has a coordinate system defined for the location of the target feature class.

Coordinate System
average_point_spacing
(Optional)

The average planimetric distance between points of the input. This parameter is only used when the output geometry is set to MULTIPOINT, and its function is to provide a means for grouping the points together. This value is used in conjunction with the points per shape limit to construct a virtual tile system used to group the points. The tile system's origin is based on the domain of the target feature class. Specify the spacing in the horizontal units of the target feature class.

Double
file_suffix
(Optional)

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
(Optional)

The decimal character used in the text file to differentiate the integer of a number from its fractional part.

  • DECIMAL_POINTA point is used as the decimal character. This is the default.
  • DECIMAL_COMMAA comma is used as the decimal character.
String

Code Sample

ASCII3DToFeatureClass example 1 (Python window)

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")
ASCII3DToFeatureClass example 2 (stand-alone script)

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)

Environments

Related Topics

Licensing Information

ArcView: Requires 3D Analyst
ArcEditor: Requires 3D Analyst
ArcInfo: Requires 3D Analyst

6/10/2013